Advertisement

OpenGL X11 app

Started by June 15, 2006 12:22 PM
6 comments, last by MrRage 18 years, 8 months ago
I've struggled a lot over the last few days trying to build glxgears.c and at this point I'd just like to know if people out there have some good documentation on getting an X11 OpenGL context working. # gcc -I/usr/X11R6/include -L/usr/X11R6/lib glxgears.c glxgears.c:501:2: warning: no newline at end of file /var/tmp//ccuhcfJ3.o(.text+0x74): In function `gear': : undefined reference to `glShadeModel' /var/tmp//ccuhcfJ3.o(.text+0x91): In function `gear': : undefined reference to `glNormal3f' /var/tmp//ccuhcfJ3.o(.text+0x9e): In function `gear': : undefined reference to `glBegin' /var/tmp//ccuhcfJ3.o(.text+0xf5): In function `gear': : undefined reference to `sin' /var/tmp//ccuhcfJ3.o(.text+0x11a): In function `gear': : undefined reference to `cos' /var/tmp//ccuhcfJ3.o(.text+0x12c): In function `gear': : undefined reference to `glVertex3f' /var/tmp//ccuhcfJ3.o(.text+0x159): In function `gear': : undefined reference to `sin' /var/tmp//ccuhcfJ3.o(.text+0x17e): In function `gear': : undefined reference to `cos' ... (this keeps going for some time) ... /var/tmp//ccuhcfJ3.o(.text+0x1bdb): In function `main': : undefined reference to `XCloseDisplay' Exit 1
Try compiling with -lX11 -lGL

Oh.. seems like your missing -lm too
:wq!
Advertisement
I'm very new to the world of command line building with GCC — so if this seams simple please bear with me. =)
You didn't include the include directories for X11 and GL.

Use the -I command
gcc -I/usr/X11R6/include -lX11 -lGL -lm glxgears.c
glxgears.c:501:2: warning: no newline at end of file
/usr/bin/ld: cannot find -lX11
Exit 1

This got me farther, but now I think I have another problem on my hands. I take it I need libm.so.3?

gcc -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lm glxgears.c
glxgears.c:501:2: warning: no newline at end of file
/usr/bin/ld: warning: libm.so.3, needed by /usr/X11R6/lib/libGL.so, not found (t ry using -rpath or -rpath-link)

Advertisement
Ok it looks like it works, I just need to fix my compat5x libs I think. Funny thing is that the stock glxgears works fine but mine complains about libs. oh well. Running under FreeBSD 6.1 with an NVidia card nvidia-driver-1.0.8178

This topic is closed to new replies.

Advertisement