Followers 0

# Configuring OpenGL problem

## 6 posts in this topic

Hello,

That's the first time I have difficulties with setting up OpenGL.

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:

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: click
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 ?

0

##### Share on other sites

Update: I managed to run the simple projet but I cannot run my old project. It might be some problem with the platform change ? Can this be fixed ?

0

##### Share on other sites

Which platform are you building on and are you linking the correct libraries for that platform?

A lot of people seem to make the mistake of switching their project over to x64 in MSVC just because they are now on a 64 bit machine. In practically all cases you will want to stay with regular x86/Win32 applications. If you do switch you will also have to get/build [b]all[/b] your libraries anew. You cannot link x86 libraries into a x64 program or the reverse. MSVC does not help there because it silently ignores all libraries for the wrong platform. This causes the annoying scenario of getting linker errors of libraries you believe you are linking.

0

##### Share on other sites

I am building on windows 8 x64. I did download all the libraries for 64bit version.

If I get it right - because previously I've built my project on 32bit system with 32bit libraries and now I am trying to use it with 64bit version libs ,that's why I am getting these linking errors.

So I have 2 options:
1. Replace all my x64 version libraries with x86

2. Continue using x64 libraries and make the whole project from scratch (that's not really good idea)

Right ?

Edited by Getov
0

##### Share on other sites

OK, I've replaced the libs, now compiles and fails at runtime: "The application was unable to start correctly (0xc000007b)"

EDIT: Managed to run it, this time it stops responding. I think that some lib bugs it but not sure which. I have no problems running other tutorials from the internet.

Can you help me with the debugging process of that thing ?

Edited by Getov
0

##### Share on other sites

No one can remotely help you there. Just attach the debugger and debug it as you would any other problem. If you do no know how to debug yet, you have to make it your single most important priority to learn it.

That said, I would advise against just turning any non-trivial x86 project into an x64 project. There is far too much that can systematically cause problems when x64-compatibility was not a design decision from the start.

Edited by BitMaster
1

##### Share on other sites

Earlier this morning I found out what caused the problem. It is bug with the GLEW library.

I had to change GLFW_OPENGL_CORE_PROFILE with GLFW_OPENGL_COMPAT_PROFILE.

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);

now it's working and everything seems OK.

0

## Create an account

Register a new account

Followers 0

• 11
• 19
• 14
• 23
• 11