Question

I just bought a new laptop with windows 8 64bit and I am using Visual Studio 2012. I did the usual procedure with installing a 3d party lib just as I installed them on my previous PCs:

  1. Download freeglut, glew, glfw, glut, sdl
  2. Copy headers into "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include"
  3. Copy libs into "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib"
  4. Copy dll's into "C:\Windows\SysWOW64"

Then I downloaded the project I was developing on my other PC (was developed under windows 8 32bit if that's of any importance) and it would'n compile. The compiler threw me the following linking error:

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

The project is working perfectly on my old PC.

I did try to make a simple new project: http://pastebin.com/GfEieL6f

Linked the following libraries (Properties->Linker->Input->Additional Dependencies)

opengl32.lib
glut32.lib
glu32.lib

And again it wouldn't compile, again the same linking errors:

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

I don't know if I am missing something, can you give me some ideas ?

PP: I managed to fix the simple program and run it, but I cannot run my old project. Maybe it's a problem because of the platform change ? How can I fix it?

Was it helpful?

Solution

  1. Don't add files to the compiler lib directory. Instead add another library search path to your project.

  2. You probably downloaded library files that aren't compatible with VC++ 2012 and your project build settings. In native code, you can't mix x86, x64, etc. Static libraries need to match your project bitness, not your OS. And Microsoft also changes/extends the library file format, as well as runtime library components used by the library, so you really should get a library file designed for your version of VC++.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top