Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

sab3156

OpenGL: Undefined Reference

This topic is 5734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When i try to compile a basic OpenGL application, i get the following: _________________________________________________________________ c:\csi\projects\game\maingame.cpp: In function `int WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)'': c:\csi\projects\game\maingame.cpp:273: warning: converting NULL to non-pointer type c:\csi\projects\game\maingame.cpp:285: warning: converting NULL to non-pointer type c:\csi\projects\game\maingame.cpp:285: warning: converting NULL to non-pointer type C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0xf):maingame.cpp: undefined reference to `glEnable@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1f):maingame.cpp: undefined reference to `glClearColor@16'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x2c):maingame.cpp: undefined reference to `glClear@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x34):maingame.cpp: undefined reference to `glLoadIdentity@0'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x39):maingame.cpp: undefined reference to `glFlush@0'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x47):maingame.cpp: undefined reference to `SwapBuffers@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x67):maingame.cpp: undefined reference to `ChoosePixelFormat@8'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x84):maingame.cpp: undefined reference to `SetPixelFormat@12'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x11b):maingame.cpp: undefined reference to `wglCreateContext@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x139):maingame.cpp: undefined reference to `wglMakeCurrent@8'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x15c):maingame.cpp: undefined reference to `wglMakeCurrent@8'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x16d):maingame.cpp: undefined reference to `wglDeleteContext@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1bd):maingame.cpp: undefined reference to `glViewport@16'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1ca):maingame.cpp: undefined reference to `glMatrixMode@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1d2):maingame.cpp: undefined reference to `glLoadIdentity@0'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x204):maingame.cpp: undefined reference to `gluPerspective@32'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x211):maingame.cpp: undefined reference to `glMatrixMode@4'' C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x219):maingame.cpp: undefined reference to `glLoadIdentity@0'' _________________________________________________________________ what am i supposed to do for this to work?

Share this post


Link to post
Share on other sites
Advertisement
I gave you the answer here. You must link the libraries. I gave you the switches to link the libraries that you need.

Where do you put the switches? I don't know; you won't tell use what IDE or build system you're using. I'd already jumped to the conclusion that you are using a GCC/MinGW32 system of some kind. Probably Dev C++, but I have no idea what version.

If you are using Dev C++, look for some type of project settings dialog and look for a linkage options textbox. Add the -lopengl32 -lglu32 -lgdi32 text to it.



[edited by - Null and Void on November 5, 2002 5:49:57 PM]

Share this post


Link to post
Share on other sites
That question cannot be answered if you do not provide us with the name of the compiler you''re using...

A quick fix that may or may not work...try adding:

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")

just after your include directives (i.e. #include <somestuff.h>)

_____________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________

Share this post


Link to post
Share on other sites
Goto "Project"->"Project Options" and add to the Linker Options/Optional Libraries line following:
-lopengl32 -lglu32
(Hope I remember it right now)
I'm not sure special libraries for DevC++ are needed, but them can propably be found at cone3d.gamedev.net
Hope this helps

edit: Just like Null and void already told :D

[edited by - stefu on November 6, 2002 5:04:01 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!