News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

I dont know how to link a library with my project

Started by SelethD, September 14, 2005, 04:56:45 PM

Previous topic - Next topic

SelethD

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?

rickg22

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 :)

SelethD

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


thomas

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."