SFML community forums

Help => Window => Topic started by: Rubenknex on December 06, 2010, 07:28:47 pm

Title: Disabling the CMD window that opens when creating a window
Post by: Rubenknex on December 06, 2010, 07:28:47 pm
Sorry if this is already discussed but I couldn't find it.

Every time I create a RenderWindow it also opens a CMD window. When distributing my game I don't want it to open. I'm sure there is a very simple solution for this but I have not found it yet.
Title: Disabling the CMD window that opens when creating a window
Post by: AdrianM on December 06, 2010, 08:48:37 pm
Maybe you should create a Win32 Project not a Console Win32 Project.
Title: Disabling the CMD window that opens when creating a window
Post by: Rubenknex on December 06, 2010, 08:55:13 pm
When I set the SubSystem to SUBSYSTEM:WINDOWS instead of SUBSYSTEM:CONSOLE it gives me this error:

1>MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16

I think it means that I must change main to WinMain but I don't really know how  :? .
Title: Disabling the CMD window that opens when creating a window
Post by: AdrianM on December 06, 2010, 10:51:12 pm
From my memory it should be something like this:

Code: [Select]

int WINAPI CALLBACK WinMain(
  HINSTANCE hInstance,
  HINSTANCE hPrevInstance,
  LPSTR lpCmdLine,
  int nCmdShow
)
{
    // do sfml stuff


   return 0;
}
Title: Disabling the CMD window that opens when creating a window
Post by: Rubenknex on December 07, 2010, 02:23:15 pm
Thanks it worked!  :D
Title: Disabling the CMD window that opens when creating a window
Post by: Laurent on December 07, 2010, 02:24:46 pm
Or you can link to sfml-main to keep main() and thus a portable code ;)