PDA

View Full Version : Compilerproblem



daZwerg
06-09-2001, 09:01 AM
i can't compile a simple gl-prog

following errors:

zwergi@workstation:~/devel/gl > gcc gltest.c -lGL -lglut -lGLU
gltest.c: In function `main':
gltest.c:31: warning: passing arg 1 of `glutInit' makes pointer from integer without a cast
/usr/lib/libglut.so: undefined reference to `XGetExtensionVersion'
/usr/lib/libglut.so: undefined reference to `XFreeDeviceList'
/usr/lib/libglut.so: undefined reference to `XQueryDeviceState'
/usr/lib/libglut.so: undefined reference to `XListInputDevices'
/usr/lib/libglut.so: undefined reference to `cos'
/usr/lib/libglut.so: undefined reference to `sin'
/usr/lib/libglut.so: undefined reference to `XFreeDeviceState'
/usr/lib/libglut.so: undefined reference to `XOpenDevice'
/usr/lib/libGLU.so: undefined reference to `tan'
/usr/lib/libglut.so: undefined reference to `XmuLookupStandardColormap'
/usr/lib/libglut.so: undefined reference to `XSelectExtensionEvent'
/usr/lib/libGLU.so: undefined reference to `fist_tessellation'
/usr/lib/libGLU.so: undefined reference to `acos'
collect2: ld returned 1 exit status

and when i use g++ instead of gcc i don't get the undefined references but i don't become an output?
where is the problem??

daZwerg
06-09-2001, 09:03 AM
I use SuSE Linux 7.2 and have an Elsa Gladiac 2 GTS

ffish
06-09-2001, 04:41 PM
Your undefined references are because you need to pass some more libraries to the linker. For the X errors, try passing -lX11. From memory there may be some others as well. On SGI machines here at uni one of my old makefiles has these: -lXmu -lXext -lX11 -lXi but not all of these will exist (I think) on Linux. I'm guessing that -lXext and -lX11 will be on Linux. You also want to pass -lm for the math functions. As for fist_tessellation, I guess that's in one of your proprietary libraries so you'll have to link that as well.

The warning at the top is probably due a mistake on your part. I'm guessing your main function looks like this:



int main(int argc, char **argv)
{
glutInit(argc, argv);
...

when it should look like this:



int main(int argc, char **argv)
{
glutInit(&argc, argv);
...


Hope that helps.

JBob
06-10-2001, 05:21 AM
I use the following command:

gcc -Wall -I/usr/X11R6/include/ -o cube -L/usr/X11R6/lib cube.c -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm

where cube.c is my file and cube is my output.
The sin, cos, etc. might be because the math library is not being included (#include<math.h> http://www.opengl.org/discussion_boards/ubb/wink.gif.
Hope this helps.
JBob