Author Topic: I dont know how to link a library with my project  (Read 5484 times)

SelethD

  • Guest
I dont know how to link a library with my project
« 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?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: I dont know how to link a library with my project
« Reply #1 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 :)

SelethD

  • Guest
Re: I dont know how to link a library with my project
« Reply #2 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
 

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: I dont know how to link a library with my project
« Reply #3 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."