我最近将我的电脑升级到Windows 10并安装了Visual Studio 2015.我尝试在Visual Studio 2015中编写一个"Hello OpenGL"程序,项目成功构建,但它已经退出代码1.我得到的就是创建的窗口出现并很快消失.这是我的代码:
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <iostream>
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowSize(800, 600);
glutInitWindowPosition(100, 100);
glutCreateWindow("Hello OpenGL");
glutMainLoopEvent();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
正如我上面提到的,项目成功构建,这是建筑物重建:
1>------ Build started: Project: HelloGL, Configuration: Debug Win32 ------
1> main.cpp
1> HelloGL.vcxproj -> D:\OpenGL Projects\HelloGL\Debug\HelloGL.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)
但是当我按F5下来调试程序时,结果却让我气馁:
The thread 0x23d4 has exited with code 1 (0x1).
The thread 0x20b8 has …Run Code Online (Sandbox Code Playgroud)