Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CMD Console!?  (Read 5802 times)

0 Members and 1 Guest are viewing this topic.

wtf

  • Newbie
  • *
  • Posts: 15
    • View Profile
CMD Console!?
« on: November 26, 2011, 12:26:18 am »
Hello, i am using Microsoft Visual C++ 2010 with SFML 2.0 on a Windows 7 computer and for some reason a console window pops up when ever i try to run any of my projects and i cant figure out a way to make it stop! Can someone please help me with my problem!?



thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
CMD Console!?
« Reply #1 on: November 26, 2011, 02:12:50 am »
You need to change your visual studio project settings.

You need to set your subsystem to "Windows" in your linker settings.
"Project Settings>Linker>System>Subsystem"

And then you also need to link to sfml-main.lib(as this library contains winmain which you need if you use the Windows subsystem)

wtf

  • Newbie
  • *
  • Posts: 15
    • View Profile
CMD Console!?
« Reply #2 on: February 20, 2012, 11:59:13 pm »
Thank you for your help. the problem has been resolved.

Meteorhead

  • Newbie
  • *
  • Posts: 22
    • View Profile
CMD Console!?
« Reply #3 on: March 15, 2012, 03:15:48 pm »
I have similar issue, but in my case the app won't compile if I set Subsystem to Windows. I get heaps of link errors, looking like this:

Code: [Select]
1>------ Build started: Project: SFML_GL_test, Configuration: Release x64 ------
1>Build started 2012.03.15. 15:08:19.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(299,5): warning MSB8004: Output Directory does not end with a trailing slash.  This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1>InitializeBuildStatus:
1>  Creating "x64\Release\SFML_GL_test.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  All outputs are up-to-date.
1>Link:
1>  All outputs are up-to-date.
1>libcmt.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: exit already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: _cexit already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: _amsg_exit already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(crt0init.obj) : error LNK2005: __xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: __xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(winxfltr.obj) : error LNK2005: _XcptFilter already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(memcpy.obj) : error LNK2005: memmove already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(mlock.obj) : error LNK2005: _unlock already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(mlock.obj) : error LNK2005: _lock already defined in MSVCRT.lib(MSVCR100.dll)
1>libcmt.lib(errmode.obj) : error LNK2005: __set_app_type already defined in MSVCRT.lib(MSVCR100.dll)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>D:\ToBeSaved\Develop\SFML_GL_test\\bin\SFML_GL_test.exe : fatal error LNK1169: one or more multiply defined symbols found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.28
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I try to link the following libraries:

sfml-main.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;opengl32.lib;glu32.lib;GLEW64.lib;

Could someone explain though how this would work in theory? My application's entry point is "int main()" although if I set Subsystem to Windows it should be looking for a WinMain function. How can a dynamically linked library override that? It certainly does something, since it does not argue about WinMain not being present, but I'm curious what exactly happens under the hood. Plus, the program compile as it is, so I would like to know what I'm doing wrong. Thx in advance.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
CMD Console!?
« Reply #4 on: March 16, 2012, 11:28:31 am »
This error has nothing to do with the topic...

It's because some of the libraries used a diffrent standard library to compile.
Make sure all SFML libraries are from the same release.
Also I don't think you have to include "opengl32.lib;glu32.lib;GLEW64.lib;" except maybe if you do some OpenGL stuff on your own.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
CMD Console!?
« Reply #5 on: March 16, 2012, 12:44:18 pm »
you should keep the console till your ready to release your game.. its very handle with cout << for debugging :P
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

Meteorhead

  • Newbie
  • *
  • Posts: 22
    • View Profile
CMD Console!?
« Reply #6 on: March 16, 2012, 07:39:35 pm »
I require OpenGL includes because the only OpenGL related feature of SFML I use is text render. Practically everything else only relies on SFML instantiting a device context, since I want to use native OpenGL 3.x-4.x. All libraries were built with the same cmake configuration and it was done in one go. I'll check on that.

About keeping the console for debugging, I have created a runtime class that accepts any output for logging so far as it has it's << operator implemented for std::string, const char*, and std::stringstream. I want to add a text box to my window using SFGUI and implement brutally simple << operator for these types. I do not want the console to pop up, since I want to avoid using it.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
CMD Console!?
« Reply #7 on: March 17, 2012, 12:52:55 am »
Quote from: "Meteorhead"
About keeping the console for debugging, I have created a runtime class that accepts any output for logging so far as it has it's << operator implemented for std::string, const char*, and std::stringstream. I want to add a text box to my window using SFGUI and implement brutally simple << operator for these types. I do not want the console to pop up, since I want to avoid using it.

I hope you have some more advantages over the console with your class otherwise it seems to me just much effort gone lost. :wink:


As for your errors there's a conflict between the C Runtime Library libcmt and msvcrt. It often happens when external libraries got compiled with diffrent runtime library settings. You can avoid this by letting the linker ingnore one or more libraries.
You can find more information about the specific runtime libraries via the following link:
http://msdn.microsoft.com/en-us/library/abx4dbyh(v=vs.80).aspx
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/