OpenGL and VS2010 unresolved external

微笑、不失礼 提交于 2020-01-05 04:23:05

问题


I want to use GLUT to simplify my code and work.

I'm using windows 7 (64 bit) and Visual Studio 2010. I did everything like in this tutorial and still can't compile my code... I get these errors:

Error 2 error LNK1120: 1 unresolved externals <path>
Error   1   error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartuL  

The code I use:

#include <GL/glew.h> 
#include <GL/glut.h> 

void display (void) {  
   glClearColor(1.0f, 0.0f, 0.0f, 1.0f);  
   glClear(GL_COLOR_BUFFER_BIT); 
   glLoadIdentity(); 

   glFlush(); 
}  

int main (int argc, char **argv) {  
   glutInit(&argc, argv); 
   glutInitDisplayMode (GLUT_SINGLE); 
   glutInitWindowSize (500, 500); 
   glutInitWindowPosition (100, 100); 
   glutCreateWindow ("Your first OpenGL Window");  

   glutDisplayFunc(display); /

   glutMainLoop(); 
} 

Does someone know whats the problem and how to fix it?


回答1:


Seems that your created Windows application instead of a Console one. See the pic below for how to change/choose the Windows subsystem



来源:https://stackoverflow.com/questions/15440476/opengl-and-vs2010-unresolved-external

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!