Code::Blocks Forums

User forums => Help => Topic started by: SelethD on September 14, 2005, 04:56:45 pm

Title: I dont know how to link a library with my project
Post by: SelethD on September 14, 2005, 04:56:45 pm
I am new to using code::blocks and I need to link glut32.lib to my project.  I cant find any docs on it or anything in the FAQ.
Can someone please help me?
Title: Re: I dont know how to link a library with my project
Post by: rickg22 on September 14, 2005, 05:04:49 pm
Ok, to link a library to your project, you add it to the Project's Build options.

In the Menu "Project", choose "Build Options", and then select the default target. Click on the "Linker" tab, and there's the Link Libraries. Click on "Add", and there ya go :)
Title: Re: I dont know how to link a library with my project
Post by: SelethD on September 14, 2005, 05:08:07 pm
Ok I did that, but im still getting the error, perhaps its something else im doing wrong?

Here is what its telling me when I have the #include <gl/glut32.h> line in my code


Project   : OpenGL Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Projects\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\Projects\OpenGL.exe
.objs\main.o:main.cpp:(.text+0x1c): undefined reference to `__glutInitWithExit@12'
.objs\main.o:main.cpp:(.text+0x3d): undefined reference to `__glutCreateWindowWithExit@8'
.objs\main.o:main.cpp:(.text+0x5d): undefined reference to `__glutCreateMenuWithExit@8'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
Title: Re: I dont know how to link a library with my project
Post by: thomas on September 14, 2005, 07:16:59 pm
Get a recent version from Nate Robins' site, the zip contains not only the static lib, but also the dll and the def file, just link against the dll, works like a charm. Static linking never worked for me.
And of course, you must link against opengl32, too.