PDA

View Full Version : help me



cicakMasin
01-02-2006, 09:36 PM
hi.. i've already type my first program using opengl but i've found a lot of error. i've look through my code and found nothing wrong..
here i paste the error that appear in my screen.

--------------

Configuration: tutorial2 - Win32 Debug-----------
Linking...
123.obj : error LNK2001: unresolved external symbol _gluPerspective@32
123.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
123.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
123.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
123.obj : error LNK2001: unresolved external symbol __imp__glHint@8
123.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
123.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
123.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
123.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
123.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
123.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
123.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
123.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
123.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
123.obj : error LNK2001: unresolved external symbol __imp__glClear@4
123.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
123.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
123.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Debug/tutorial2.exe : fatal error LNK1120: 18 unresolved externals
Error executing link.exe.

tutorial2.exe - 19 error(s), 0 warning(s)

-------------

how's that happen. can someone fix that to me. i tot it must b a compiler error. i really need ur help. thanks again in advance.

RigidBody
01-03-2006, 12:53 AM
actually it's not a compiler error- the compilation was ok. "unresolved external symbol" means that the linker did not find a function that you used in your code. the listed functions are included in opengl32.dll, glu32.dll and gdi32.dll, i guess, so you should set the compiler flags accordingly.

i do not often program in windows, so i cannot give you much advice on how to set the library flags. i use a borland compiler on the command line, so for me it would look like

bcc32 -o test test.cpp -lopengl32 -lglu32 -lgdi32

mikael_aronsson
01-03-2006, 12:57 AM
Hi !

There is nothing wrong with your code, but you need to tell the linker that you use OpenGL, you need to add the opengl32.lib import library to your project, if you are using Visual Studio right click the project name in the solution tree, select "Properties" from the menu and open the "Linker" branch in the Configuration properties tree, select "Input" branch and enter "opengl32.lib" in the "Additional Dependencies" text box. (in your case you also need to add the glu32.lib because you use GLU functions).