天天看點

OpenGL編譯錯誤的解決

如果使用OpenGL的時候出現一下啊錯誤

1>TEE.obj : error LNK2019: 無法解析的外部符号 [email protected],該符号在函數 [email protected] 中被引用

1>TEE.obj : error LNK2019: 無法解析的外部符号 __imp____glutCr[email protected],該符号在函數 [email protected] 中被引用

或者

1>Simulator.obj : error LNK2001: 無法解析的外部符号 [email protected]

1>Simulator.obj : error LNK2001: 無法解析的外部符号 [email protected]

則恰好在#include<gl/glut.h>之前加上

define GLUT_DISABLE_ATEXIT_HACK

注:一定要恰好在#include glut.h之前加入以上代碼,正确用法如下:

#define GLUT_DISABLE_ATEXIT_HACK

#include<gl/glut.h>