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

Author Topic: Disabling the CMD window that opens when creating a window  (Read 3410 times)

0 Members and 1 Guest are viewing this topic.

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Disabling the CMD window that opens when creating a window
« 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.

AdrianM

  • Newbie
  • *
  • Posts: 43
    • View Profile
Disabling the CMD window that opens when creating a window
« Reply #1 on: December 06, 2010, 08:48:37 pm »
Maybe you should create a Win32 Project not a Console Win32 Project.

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Disabling the CMD window that opens when creating a window
« Reply #2 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  :? .

AdrianM

  • Newbie
  • *
  • Posts: 43
    • View Profile
Disabling the CMD window that opens when creating a window
« Reply #3 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;
}

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Disabling the CMD window that opens when creating a window
« Reply #4 on: December 07, 2010, 02:23:15 pm »
Thanks it worked!  :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Disabling the CMD window that opens when creating a window
« Reply #5 on: December 07, 2010, 02:24:46 pm »
Or you can link to sfml-main to keep main() and thus a portable code ;)
Laurent Gomila - SFML developer

 

anything