设置 OpenGL - 它不起作用
Setting up OpenGL - it won't work
我刚买了一台windows 8 64位的笔记本电脑,我用的是Visual Studio 2012。我做了安装3d party lib的常规程序,就像我在以前的pc上安装它们一样:
- 下载免费eglut, glfw, glut, sdl
- 复制头文件到"C:Program Files (x86)Microsoft Visual Studio 11.0VCinclude"
- 将库复制到"C:Program Files (x86)Microsoft Visual Studio 11.0VClib"
- 将dll拷贝到"C:WindowsSysWOW64"
然后我下载了我在另一台电脑上开发的项目(如果这很重要的话,是在windows 8 32位下开发的),它无法编译。编译器抛出了以下链接错误:
Error 1 error LNK2001: unresolved external symbol __imp__glDrawArrays@12 - about 50 of these
Error 63 error LNK2019: unresolved external symbol __imp__glClear@4 - again about 50 of these
这个项目在我的旧电脑上运行得很好。
我试着做一个简单的新项目:http://pastebin.com/GfEieL6f
链接以下库(属性->链接器->输入->附加依赖项)
opengl32.lib
glut32.lib
glu32.lib
仍然无法编译,同样的链接错误:
Error 1 error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 2 error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 3 error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 4 error LNK2019: unresolved external symbol __imp__glColor3f@12 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 5 error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 6 error LNK2019: unresolved external symbol __imp__glFlush@0 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 7 error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _main P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 8 error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 9 error LNK2019: unresolved external symbol __imp__glOrtho@48 referenced in function _main P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 10 error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
Error 11 error LNK2019: unresolved external symbol __imp__glVertex3iv@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:OpenGL_SetupOpenGL_Setupopengl_setup.obj
我不知道我是否遗漏了什么,你能给我一些建议吗?
p:我设法修复了简单的程序并运行它,但是我不能运行我的旧项目。也许是因为平台的改变?我该怎么修理它?-
不要在编译器
lib
目录下添加文件。在项目中添加另一个库搜索路径。 -
您可能下载了与vc++ 2012和您的项目构建设置不兼容的库文件。在本机代码中,不能混合使用x86、x64等。静态库需要匹配你的项目,而不是你的操作系统。而且微软还改变/扩展了库文件格式,以及库使用的运行时库组件,所以你真的应该得到一个为你的vc++版本设计的库文件。
相关文章:
- OpenGL 3.0+:正交矩阵不起作用
- OpenGL中使用Freetype进行字体渲染的问题不起作用
- 纹理不起作用 - OpenGL
- Opengl 4 调试输出不起作用
- 在某些情况下,多个 OpenGL 纹理不起作用?
- 检查刻度中的坐标不起作用(OpenGL)
- QT在CentOS 7的openGL不起作用
- OpenGL照明不起作用
- OpenGL 纹理坐标不起作用
- OpenGL 第一个多维数据集渲染不起作用
- Opengl 旋转不起作用
- OpenGL代码在GLFW上工作,但在QT OpenGL上不起作用
- OpenGL 深度测试不起作用
- 纹理绑定不起作用 / C++ / OpenGL
- 在OpenGL中绘制VBO不起作用
- OpenGL 移动对象不起作用
- C++ OpenGL 着色器不起作用
- 为什么我的 OpenGL 纹理不起作用?
- 使用默认构造函数调用的网格类不起作用 OpenGL C++
- 深度缓冲区似乎不起作用-OpenGL着色器