PDA

View Full Version : Compiling problem...



ben65535a
06-30-2002, 06:36 PM
i have included all the proper header files such as gl.h, glut.h, and etc. but when i compile the source code, the linker gives me undefined reference to whatever function i used...and they're correctly typed as the prototype appeared in the header file...
is there something i have to do before compiling the source code?

rts
06-30-2002, 09:17 PM
Well, see, when the linker complains then you are getting linker problem, not compiler problems.

Linker problems are usually the result of not properly specifying the proper libraries to link with.

Here is a typical link command-line for OpenGL. Modify to taste:

gcc -o <exe> <list of objects> -L/usr/X11R6/lib -lGL -lGLU -lglut -lm

ben65535a
07-01-2002, 03:27 PM
what if it still doesn't work?

Ben Hsu

nitch
07-08-2002, 05:09 PM
do i have to type all these words,

everytime i compile the source files.
(gcc -o <exe> <list of objects> -L/usr/X11R6/lib -lGL -lGLU -lglut -lm)

aren't there any convient methods?

ben65535a
07-08-2002, 06:29 PM
you can use a Makefile...that simplifies things...

Ben Hsu

** and i still stress, it does not compile on my machine... RH7.2, video card recently burnt out, using RAM for my video card (motherboard buildin), didn't change driver. **

[This message has been edited by ben65535a (edited 07-08-2002).]

07-08-2002, 07:41 PM
For the latest RH with nvidias library do I only have to type -lglut. Use the advanced command line editing functions if you have to give long commands several times. Here is a little list with some of them I use all the time:
Up arrow - previous command
Ctrl+r - incremental search of previous commands
Ctrl+k - kill the rest of line
Ctrl+y - yank (paste) the previous killed
Ctrl+a - beginning of line
Ctrl+e - end of line

As you can see is it the emacs keybindings but I think that can be changed. Some of them also works for other text input like in your web browser.