Just learning OpenGL, when drawing graphics, if not set, run the time will appear in the Black window before the Windows window.
In fact, to remove the console window is very simple, only need to modify the project settings, the subsystem to Windows, the entry point of the program to change to mainCRTStartup.
Let me first list some of the solutions, and then explain my understanding.
Method One: Add a sentence #pragma comment (linker, "/subsystem:\" windows\ "/entry:\" Maincrtstartup\ ") in the program, and it is recommended to add the following to the include.
Method Two: Modify the project settings.
For VC6, place in Project->setting->link->project Options.
The interface after the point is opened,
In the lower right corner of project options, find/subsytem:, and then change the parameters behind it to Windows, and then find/entry:, the value of the following changes to "mainCRTStartup", if not found on the Add, the final effect is/ Subsystem:windows/entry: "mainCRTStartup".
For VS2008, the local item---Properties--linker,
Then on the left, select Advanced,
Enter mainCRTStartup at the top entry point, then select System,
Select Windows on the top subsystem.
Why is this set to be done? Mainly because there are several subsystems under the Windows system, one is the console, one is the window subsystem, if the establishment of the console project is definitely to create a control platform system program, the establishment of Windows Application and MFC and other projects are window subsystem. Different subsystems will link different main functions, the console will link to main, the window will link to WinMain, if the mismatch will definitely fail the link.
Now that we're using OpenGL programming, and we're building a console project, we're going to have a black window if we don't set it up, so we'll change the engineering subsystem to Windows, but we don't want to change the main function to WinMain, because it's going to be a hassle, So we changed the entrance of the program into mainCRTStartup. Also if the Win32 app project, we can change the subsystem into a console, and then set the program entrance to WinMainCRTStartup, it should be the opposite effect.
OpenGL Learning Note: How to not display the console under Console Project Black window only displays Windows window