Compiling problem...

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?

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

what if it still doesn’t work?

Ben Hsu

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?

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).]

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.