PDA

View Full Version : unresolved external symbol



TolTol
01-12-2004, 11:29 AM
Hello there,

I'm getting these linker errors when I compile and execute my VC++ MFC application.

I've included the header files for OpenGL.
I've checked all functions for correct parameter type.

Open.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
Open.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Open.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Open.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Open.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Open.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
Open.obj : error LNK2001: unresolved external symbol __imp__glHint@8
Open.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
Open.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
Open.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
Open.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Open.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
Open.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
Open.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
Open.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
Open.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
Open.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
Open.obj : error LNK2001: unresolved external symbol __imp__glClear@4
Debug/Gest_Rep.exe : fatal error LNK1120: 18 unresolved externals

Any ideas whats wrong?

Thanks in advance.

chowe6685
01-12-2004, 11:42 AM
have you linked with the libraries ie
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")

01-12-2004, 01:49 PM
Perfect, thanks very much!!

01-16-2004, 09:19 PM
Originally posted by ToTol:
Perfect, thanks very much!!

01-19-2004, 07:38 PM
There has -got- to be a better way to do this than with #pragma. Is there some standardized way to do this? Because any implementation of #pragma is, by definition, not standard...

ZbuffeR
01-19-2004, 10:40 PM
chowe6685 said that you need to link the libraries. And told how to do that with MSVC++. Each linker will have its own way. With gcc under windows, add -lopengl32 -lglu32 to the command line.