我刚买了一台装有 Windows 8 64 位的新笔记本电脑,我正在使用 Visual Studio 2012。我按照通常的程序安装了 3d 派对库,就像我在以前的 PC 上安装它们一样:
- 下载 freeglut、glew、glfw、glut、sdl
- 将标头复制到“C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include”
- 将库复制到“C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib”
- 将 dll 复制到“C:\Windows\SysWOW64”
然后我下载了我在另一台 PC 上开发的项目(如果这很重要,是在 windows 8 32bit 下开发的),它不会编译。编译器向我抛出了以下链接错误:
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
该项目在我的旧 PC 上运行良好。
我确实尝试过制作一个简单的新项目: 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_Setup\OpenGL_Setup\opengl_setup.obj
Error 2 error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 3 error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 4 error LNK2019: unresolved external symbol __imp__glColor3f@12 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 5 error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 6 error LNK2019: unresolved external symbol __imp__glFlush@0 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 7 error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 8 error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 9 error LNK2019: unresolved external symbol __imp__glOrtho@48 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 10 error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 11 error LNK2019: unresolved external symbol __imp__glVertex3iv@4 referenced in function "void __cdecl drawcube(void)" (?drawcube@@YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
我不知道我是否遗漏了什么,你能给我一些想法吗?
PP:我设法修复并运行了这个简单的程序,但我无法运行我的旧项目。也许这是因为平台变化的问题?我该如何解决?