View Full Version : Linker issues

02-19-2010, 09:41 AM
An Enigma is before me.

I am getting 31 typical linker message in Visual C++ (express):
1>main.obj : error LNK2019: unresolved external symbol _glEnd referenced in function "void __cdecl drawCube(void)" (?drawCube@@YAXXZ)

This is a program I have compiled before with a different compiler. I have taken care to add opengl32.lib glu32.lib and glut32.lib as "additional dependencies." I have also verified that it is finding the lib files (located in prog files/MS SDK/Windows/v6.../lib

I have also done a dumpbin on the lib files to be sure the symbols are exported there.

What is the problem here?!

02-19-2010, 11:22 AM
Did you #include "windows.h"?

02-19-2010, 12:00 PM
Yes I did (before opengl related headers)

02-19-2010, 01:07 PM
Sure that he links opengl32.lib ?

For example with Visual C++ 2008:

#pragma comment(lib,opengl32.lib)

02-23-2010, 05:59 AM
I don't believe you have to add the #pragma line if you have added the library in the linker options. Even so, I tried that and still have the exact same problem (plus you forgot the quotes around the library name). I did it for opengl32.lib, glu32.lib, and glut32.lib.

Any other ideas?