Error 1 error LNK2001: unresolved external symbol __imp____glutInitWithExit@12 opengltest.obj opengltest
Error 3 fatal error LNK1120: 2 unresolved externals
后来去h文件找到这样一条信息:
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK
因此在#include glut.h之前加入:
#define GLUT_DISABLE_ATEXIT_HACK
编译通过,运行ok。
后来又在网上验证了大家使用了同一解决方法。
如: