tags:

views:

86

answers:

1

In C++, what is the standard way to remove the command prompt, without using WinMain()? This is hopefully a simple question. I am using MSVC.

+5  A: 

First you need to set /SUBSYSTEM:WINDOWS (as opposed to /SUBSYSTEM:CONSOLE), you can do this in GUI (right click the project, properties, Linker, System, Subsystem).

Then you have to either

  1. define WinMain, or
  2. define main and set the entry point to mainCRTStartup (properties, Linker, Advanced, entry point).
avakar
Good, it worked. Is there a solution that will not require me to change any project settings. Like a preprocessor or macro, ect...
Alexander Rafferty
using `#pragma comment(linker, "/SUBSYSTEM:WINDOWS")` you could do the same for the other options. Check the `pragma` preprocessor.
st0le
I'll check it out.
Alexander Rafferty