Reputation: 6137
How do I setup my project so that it opens a window instead of console?
#include <GL\glew.h>
#include <GL\glfw.h>
int main()
{
glfwInit();
glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
glfwTerminate();
return 0;
}
This code opens a window but it also opens a console, how do setup my project so that only window appear? Using VS 2010.
Upvotes: 2
Views: 593
Reputation: 1014
Use
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
instead of
int main()
and set SubSystem to Windows (/SUBSYSTEM:WINDOWS) in Project properties/Linker/System
Don't forget to add
#include "Windows.h"
Upvotes: 0
Reputation: 162164
See my answer here: https://stackoverflow.com/a/6882500/524368
(Verbatim quote):
In the project build linker options set
/SUBSYSTEM:windows
/ENTRY:mainCRTStartup
Or use the following #pragma in the source file with the int main(...)
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
Upvotes: 3
Reputation: 490178
The linker automatically assumes you want to use the console subsystem when you have a function named main
. A few obvious (but untested) possibilities would be:
-subsystem:windows
to the linkerUpvotes: 2