Sign in to follow this  

Linker Errors

This topic is 4718 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

What do I do when I get errors like these (these are the only errors I'm getting):
Quote:
Executing make... make.exe -f "C:\Program Files\Abyss Web Server\htdocs\fft_online\Makefile.win" all g++.exe compwinapp/main.o -o "test.exe" -L"C:/Dev-Cpp/lib" -mwindows compwinapp/main.o(.text+0xea):main.cpp: undefined reference to `wglCreateContext@4' compwinapp/main.o(.text+0x108):main.cpp: undefined reference to `wglMakeCurrent@8' compwinapp/main.o(.text+0x12c):main.cpp: undefined reference to `wglMakeCurrent@8' compwinapp/main.o(.text+0x13c):main.cpp: undefined reference to `wglDeleteContext@4' compwinapp/main.o(.text+0x19e):main.cpp: undefined reference to `glViewport@16' compwinapp/main.o(.text+0x1ad):main.cpp: undefined reference to `glMatrixMode@4' compwinapp/main.o(.text+0x1b5):main.cpp: undefined reference to `glLoadIdentity@0' compwinapp/main.o(.text+0x1df):main.cpp: undefined reference to `gluPerspective@32' compwinapp/main.o(.text+0x1ee):main.cpp: undefined reference to `glMatrixMode@4' compwinapp/main.o(.text+0x1f6):main.cpp: undefined reference to `glLoadIdentity@0' compwinapp/main.o(.text+0x413):main.cpp: undefined reference to `glClear@4' compwinapp/main.o(.text+0x41b):main.cpp: undefined reference to `glLoadIdentity@0' compwinapp/main.o(.text+0x46f):main.cpp: undefined reference to `glTranslatef@12' compwinapp/main.o(.text+0x49a):main.cpp: undefined reference to `glRotatef@16' compwinapp/main.o(.text+0x4bc):main.cpp: undefined reference to `glColor3f@12' compwinapp/main.o(.text+0x4cb):main.cpp: undefined reference to `glBegin@4' compwinapp/main.o(.text+0x4ed):main.cpp: undefined reference to `glVertex3f@12' compwinapp/main.o(.text+0x50f):main.cpp: undefined reference to `glVertex3f@12' compwinapp/main.o(.text+0x531):main.cpp: undefined reference to `glVertex3f@12' compwinapp/main.o(.text+0x539):main.cpp: undefined reference to `glEnd@0' make.exe: *** [test.exe] Error 1 Execution terminated
I'm using Dev C++. Any ideas appreciated.

Share this post


Link to post
Share on other sites
You gotta use the .lib versions. dynamic link libraries(dll's) link to the executable. libs link with the code and stuff. Without the .lib included the compiler cannot link those functions and so it gives you a linker error.

Go look at how to include libraries (.lib) for Dev C++ and add the glu32.lib and opengl.lib so it can link those functions. This will probably fix your problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by algumacoisaqualquer
Well, open your project Options (Alt + P), go into Parameters, and in the Linker colun type:
-lopengl32
-lglu32
This is probably going to solve it (I'm kind of a newbie to, but I think that's how you link to a lib).

Same as doing
-libopengl32.a
-libglu32.a
libraries in gcc (the compiler that dev-cpp uses) ends with .a, and not .lib.
And since there is a shortcut (-lxxx), it will be easier if you'll call your libraries libxxx.a rather than xxx.a so you can use this shortcut.
More people know including libraries in gcc as -lxxx than -xxx.a.

Share this post


Link to post
Share on other sites

This topic is 4718 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this