zoukankan      html  css  js  c++  java
  • 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_PlayerAgainDebugBVH_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),都会出现这样的问题。

  • 相关阅读:
    使用PHP建立GIF
    无数据库的详细域名查询程序PHP版
    用PHP实现通过Web执行C/C 程序
    判断一数是否在一已知数组中的函数
    如何将本地项目上传到码云
    IIS服务器,IIS日志文件占用C盘空间,C盘空间不足 常见问题
    谈谈个人能力的系统性
    毕业后5年决定命运
    个人取得工资、薪金所得应当如何缴纳个人所得税
    Chart 控件 for vs2008的安装
  • 原文地址:https://www.cnblogs.com/OneDream/p/3298051.html
Copyright © 2011-2022 走看看