Reputation: 223
Premise: I'm very very new to Windows programming.
So far every small program I compiled, at the moment of the execution (...double click from the GUI) opens automatically a console where it prompts the std output.
Here is a screen-shot which shows the execution of this example
As you can see, behind the window created by the program there is a console.
Why is this happening and how to prevent it?
Upvotes: 0
Views: 177
Reputation:
Windows programs come in two subsystems: windows or console. When you start a console program, a console is automatically created (if it does not exist already). Since console is the default, you have to set the appropriate linker option /SUBSYSTEM:WINDOWS
when building your program.
There is no fundamental difference between the two subsystems. Windows programs can create a console and console programs can create windows, so you end up with both a window and a console.
There are more subsystems but they are not relevant to your question. For more information see https://msdn.microsoft.com/en-us/library/fcc1zstk.aspx (also contains information about setting the linker option in Visual Studio)
Upvotes: 2