openGL产生的 error LNK2001: 无法解析的外部符号 __imp_glBegin

来源:互联网 发布:织带软件 编辑:程序博客网 时间:2024/06/05 04:29

  error LNK1120: 53 个无法解析的外部命令 D:\weiLi\vs2013test\json_feature_extractor\x64\Debug\json_feature_extractor.exe json_feature_extractor
  error LNK2001: 无法解析的外部符号 __imp_glBegin D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GLTexImage.obj)          json_feature_extractor
  error LNK2001: 无法解析的外部符号 __imp_glBindTexture D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GLTexImage.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glDrawBuffer D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GLTexImage.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glDrawBuffer D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(PyramidGL.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glEnable D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GlobalUtil.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glEnd D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GLTexImage.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glFinish D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(PyramidGL.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glFlush D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GLTexImage.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glFlush D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(PyramidGL.obj) json_feature_extractor
 error LNK2001: 无法解析的外部符号 __imp_glGetError D:\weiLi\vs2013test\json_feature_extractor\json_feature_extractor\sift_gpu.lib(GlobalUtil.obj) json_feature_extracto


解决方法:

Visual C++ 2013 中已经提供了对 OpenGL 库的支持,这里主要需要配置的是 GLUT。GLUT 是一个与窗口系统无关的工具包,当我们在写 OpenGL 程序时,可以通过 GLUT 实现简单的窗口的创建等操作,免去了学习特定 OS 下 GUI库的过程。
glut下载地址:

http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

将下载的文件解压后,将把里面的文件移动到以下文件夹

glut.h —> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\gl
glut.dll,glut32.dll —>C:\Windows\SysWOW64 (64位操作系统)
—> C:\Windows\System32 (32位操作系统)

glut.lib,glut32.lib —> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib

以上,配置成功!


还要注意

在【连接器->常规->附加库目录】在里面选入选择x64的库目录,如我自己的机器上是:C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64

因为VS默认是win32的库目录,所以要手动加入x64库目录,加入之后就可以了