VS2010 下配置opeNGL遇到的问题
在基于动作捕捉系统驱动的虚拟人模型中要进行虚拟人重绘,于是开始开始搞openGL ,以前配置openGL的时候没有这么麻烦,这次配置openGL的时候老是出现很多问题,可能是VS2010的原因,按照网上的教程对IDE的环境进行了配置,建立了一个win32 控制台程序,进行demo测试的时候发现老是通不过会出现以下的错误:
ain.obj : error LNK2001: 无法解析的外部符号 __imp____glutInitWithExit@12
1>main.obj : error LNK2001: 无法解析的外部符号 __imp____glutCreateWindowWithExit@8
1>F:\中间临时程序库\BVH_PlayerAgain\Debug\BVH_PlayerAgain.exe : fatal error LNK1120: 2 个无法解析的外部命令
开始在网上找错误的时候确实也是找到了需要添加#define GLUT_DISABLE_ATEXIT_HACK
可能开始的时候没有将这个宏的位置放对,我是直接放到#include<GL/glut.h>后面
编译的结果老是通不过,还是一个样
后来几番折腾,于是开始将这个宏放在主文件的最前面,奇妙发生了,通过了,这是以前从来没有遇到的问题,还是药吧记下来
在网上查找了这个宏的一些定义,然后找找吹按这个问题的原因
Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
我理解把它当成Glut 库使用时的一个瑕疵。只要我们使用了OpenGL使用库(glut),都会出现这样的问题。
posted on 2013-09-03 09:29 AAAAAApple 阅读(790) 评论(0) 编辑 收藏 举报