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),都会出现这样的问题。

  • 相关阅读:
    P2P理财友情提示
    P2P理财友情提示
    如何在Chrome development tool里查看C4C前台发送的请求细节
    CRM和ERP的Sales Organization的映射关系
    如何从ERP将Material的Batch信息下载到CRM并存储在settype COMM_PR_BATCH里
    CRM中间件里的发布-订阅者模式
    CRM订单状态的Open, In process和Completed这些条目是从哪里来的
    如何证明CRM WebClient UI上的应用是有状态(Stateful)的
    如何使用代码获得一个function module的Where Used List
    观察者模式在One Order回调函数中的应用
  • 原文地址:https://www.cnblogs.com/OneDream/p/3298051.html
Copyright © 2011-2022 走看看