解决VS 2010调用OpenGL时遇到的问题
2013-03-21 11:04
330 查看
问题1、error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8
solution:
Try define the following line right before including the header, glut.h.
#define GLUT_DISABLE_ATEXIT_HACK
为什么出现这个错误,这是我在网站上找到的原因,和大家分享一下:
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. */
solution:
Try define the following line right before including the header, glut.h.
#define GLUT_DISABLE_ATEXIT_HACK
为什么出现这个错误,这是我在网站上找到的原因,和大家分享一下:
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. */
相关文章推荐
- 解决VS 2010调用OpenGL时遇到的问题:error LNK2019
- 怎样解决CodeBlocks运行VS编写的OpenGL项目时遇到的各种问题的
- VS 2008/2010无法清理解决方案和项目问题的解决
- 在access的vba中循环调用带参数查询时遇到的问题及解决办法
- C#调用非托管DLL时遇到“找不到指定的模块”问题解决方法
- 项目从VS2010 升 VS2012 遇到的代表性问题及解决
- 使用VS编写ASP.NET(C#)遇到问题及解决(持续补充)
- JAVA+AXIS客户端调用Asp.net Web Service过程中遇到的问题及解决方法
- VS2010(64位) DLL 无法正常加载问题解决方案
- unity 3D在调用JsonFx遇到的问题及解决
- 对调用了TypeMock.net的代码进行调试遇到的怪问题--在vs.net中启动resharper自带的unit test的过程和方式是什么样的?
- VC2010升级到VC2015遇到问题及解决办法
- 在VS.NET 2003中建立项目时遇到的两个问题及解决方法
- VS2010遇到_WIN32_WINNT宏定义问题
- mfc调用Qt遇到的问题及解决办法
- Java 中调用birt 的开发中遇到的问题和解决
- vs 2015 结合新配置的IIS 发布网站过程中遇到的问题及解决办法?
- 11.Cocos2dx2.2下使用JNI技术调用jar包里面的一些方法遇到的一些问题及解决方式。
- Lync Server 2010 客户端访问提示验证服务器中的证书时遇到问题解决方法
- JNI调用出现XXX遇到问题已退出解决方法