   OpenGL X11 app
  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.cglxgears.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 -lGLOh.. seems like your missing -lm too;  I did get fewer errors this time.  I'll post the glxgears source if you think it's a problem with the code I downloaded.gcc -lX11 -lGL -lm glxgears.cglxgears.c:36:22: X11/Xlib.h: No such file or directoryglxgears.c:37:24: X11/keysym.h: No such file or directoryglxgears.c:38:19: GL/gl.h: No such file or directoryglxgears.c:39:20: GL/glx.h: No such file or directoryglxgears.c:83: error: syntax error before "view_rotx"glxgears.c:83: warning: data definition has no type or storage classglxgears.c:84: error: syntax error before "gear1"glxgears.c:84: warning: data definition has no type or storage classglxgears.c:85: error: syntax error before "angle"glxgears.c:85: warning: data definition has no type or storage classglxgears.c:100: error: syntax error before "inner_radius"glxgears.c: In function `gear':glxgears.c:103: error: syntax error before "i"glxgears.c:108: error: `r0' undeclared (first use in this function)glxgears.c:108: error: (Each undeclared identifier is reported only onceglxgears.c:108: error: for each function it appears in.)glxgears.c:108: error: `inner_radius' undeclared (first use in this function)glxgears.c:109: error: `r1' undeclared (first use in this function)glxgears.c:109: error: `outer_radius' undeclared (first use in this function)glxgears.c:109: error: `tooth_depth' undeclared (first use in this function)glxgears.c:110: error: `r2' undeclared (first use in this function)glxgears.c:112: error: `da' undeclared (first use in this function)glxgears.c:112: error: `teeth' undeclared (first use in this function)glxgears.c:114: error: `GL_FLAT' undeclared (first use in this function)glxgears.c:119: error: `GL_QUAD_STRIP' undeclared (first use in this function)glxgears.c:120: error: `i' undeclared (first use in this function)glxgears.c:122: error: `width' undeclared (first use in this function)glxgears.c:133: error: `GL_QUADS' undeclared (first use in this function)glxgears.c:185: error: `u' undeclared (first use in this function)glxgears.c:186: error: `v' undeclared (first use in this function)glxgears.c:187: error: `len' undeclared (first use in this function)glxgears.c:213: error: `GL_SMOOTH' undeclared (first use in this function)glxgears.c: In function `draw':glxgears.c:230: error: `GL_COLOR_BUFFER_BIT' undeclared (first use in this function)glxgears.c:230: error: `GL_DEPTH_BUFFER_BIT' undeclared (first use in this function)glxgears.c: In function `reshape':glxgears.c:263: error: syntax error before "h"glxgears.c:265: error: `GLint' undeclared (first use in this function)glxgears.c:265: error: syntax error before "width"glxgears.c:266: error: `GL_PROJECTION' undeclared (first use in this function)glxgears.c:268: error: `h' undeclared (first use in this function)glxgears.c:269: error: `GL_MODELVIEW' undeclared (first use in this function)glxgears.c: In function `init':glxgears.c:278: error: syntax error before "pos"glxgears.c: At top level:glxgears.c:279: error: syntax error before "red"glxgears.c:279: warning: data definition has no type or storage classglxgears.c:280: error: syntax error before "green"glxgears.c:280: warning: data definition has no type or storage classglxgears.c:281: error: syntax error before "blue"glxgears.c:281: warning: data definition has no type or storage classglxgears.c:283: warning: parameter names (without types) in function declarationglxgears.c:283: warning: data definition has no type or storage classglxgears.c:284: warning: parameter names (without types) in function declarationglxgears.c:284: warning: data definition has no type or storage classglxgears.c:285: warning: parameter names (without types) in function declarationglxgears.c:285: warning: data definition has no type or storage classglxgears.c:286: warning: parameter names (without types) in function declarationglxgears.c:286: warning: data definition has no type or storage classglxgears.c:287: warning: parameter names (without types) in function declarationglxgears.c:287: warning: data definition has no type or storage classglxgears.c:290: error: initializer element is not constantglxgears.c:290: warning: data definition has no type or storage classglxgears.c:291: warning: parameter names (without types) in function declarationglxgears.c:291: warning: data definition has no type or storage classglxgears.c:292: warning: parameter names (without types) in function declarationglxgears.c:292: warning: data definition has no type or storage classglxgears.c:293: error: syntax error before numeric constantglxgears.c:294: warning: data definition has no type or storage classglxgears.c:296: error: initializer element is not constantglxgears.c:296: warning: data definition has no type or storage classglxgears.c:297: warning: parameter names (without types) in function declarationglxgears.c:297: warning: data definition has no type or storage classglxgears.c:298: warning: parameter names (without types) in function declarationglxgears.c:298: warning: data definition has no type or storage classglxgears.c:299: error: syntax error before numeric constantglxgears.c:300: warning: data definition has no type or storage classglxgears.c:302: error: initializer element is not constantglxgears.c:302: warning: data definition has no type or storage classglxgears.c:303: warning: parameter names (without types) in function declarationglxgears.c:303: warning: data definition has no type or storage classglxgears.c:304: warning: parameter names (without types) in function declarationglxgears.c:304: warning: data definition has no type or storage classglxgears.c:305: error: syntax error before numeric constantglxgears.c:306: warning: data definition has no type or storage classglxgears.c:308: warning: parameter names (without types) in function declarationglxgears.c:308: warning: data definition has no type or storage classglxgears.c:309: error: syntax error before '}' tokenExit 1;  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.cglxgears.c:501:2: warning: no newline at end of file/usr/bin/ld: cannot find -lX11Exit 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.cglxgears.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);  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   