Archived

This topic is now archived and is closed to further replies.

mikael_j

linking glut program fails

Recommended Posts

I''m really being quite lazy now, asking here after only a few different attempts at getting my stupid program to link itself, but here goes. I''m trying to write a small OpenGL program using glut, I am doing all of this on my peecee running freebsd 4.3, the problem is as you might have guessed that it refuses to link, I''ve tried adding
-L/usr/X11R6/lib -L/usr/X11R6/lib/libGL.so
 
...and so on during the linking, but it hasn''t helped the least bit, I still get linker errors (btw the compiler is, of course, gcc). I am now begging you, please help lazy old me! linker output:
/tmp/ccc18i2c.o: In function `main'':
/tmp/ccc18i2c.o(.text+0x12): undefined reference to `glutInit''
/tmp/ccc18i2c.o(.text+0x1f): undefined reference to `glutInitDisplayMode''
/tmp/ccc18i2c.o(.text+0x31): undefined reference to `glutInitWindowSize''
/tmp/ccc18i2c.o(.text+0x40): undefined reference to `glutInitWindowPosition''
/tmp/ccc18i2c.o(.text+0x50): undefined reference to `glutCreateWindow''
 
/Mikael Jacobson (who is tired and not in a mood for trying to figure out why silly programs won''t link like they''re supposed to)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Could I trouble you with your ''ld'' command and all the switches?

This is what I get for an ''ld -v ''

ld: warning: cannot find entry symbol _start; defaulting to 080482b8
/usr/lib/libc.so: undefined reference to `environ''
/usr/lib/libc.so: undefined reference to `__progname''
GNU ld version 2.9.1 (with BFD 2.9.1)

Share this post


Link to post
Share on other sites
ld output in win2k:

GNU ld version 2.11.90 (with BFD 2.11.90)





Here is how I compile and link my OpenGL programs:

cygwin command:

gcc -c -Wall main.c -o main.o
gcc -Wall main.o -o main.exe -luser32 -lgdi32 -lglu32 -lglut32 -lopengl32 -W1,--subsystem,windows


FreeBSD command:

gcc -c -Wall main.c -o main.o
gcc -Wall main.o -o main.exe -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lGLU -lglut -lm



/Mikael Jacobson

Edited by - mikael_j on November 17, 2001 4:36:15 PM

Share this post


Link to post
Share on other sites