OpenGL Learning Note: How to not display the console under Console Project Black window only displays Windows window

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.