Get these errors when compiling

/tmp/cc5mi2Ic.o(.text+0x57): In function `sCredits_resizeWindow':
: undefined reference to `gluOrtho2D'
/tmp/cc5mi2Ic.o(.text+0x145): In function `main_resizeWindow':
: undefined reference to `gluOrtho2D'
/tmp/cc5mi2Ic.o(.text+0x692): In function `sun_distance':
: undefined reference to `sqrt'
/tmp/cc5mi2Ic.o(.text+0x7b3): In function `sun_drawSun':
: undefined reference to `gluNewQuadric'
/tmp/cc5mi2Ic.o(.text+0x7c6): In function `sun_drawSun':
: undefined reference to `gluQuadricDrawStyle'
/tmp/cc5mi2Ic.o(.text+0x819): In function `sun_drawSun':
: undefined reference to `gluSphere'
/tmp/cc5mi2Ic.o(.text+0x829): In function `sun_drawMoon':
: undefined reference to `gluNewQuadric'
/tmp/cc5mi2Ic.o(.text+0x83c): In function `sun_drawMoon':
: undefined reference to `gluQuadricDrawStyle'
/tmp/cc5mi2Ic.o(.text+0x892): In function `sun_drawMoon':
: undefined reference to `gluSphere'
/tmp/cc5mi2Ic.o(.text+0xbbf): In function `camera_rotate':
: undefined reference to `cos'
/tmp/cc5mi2Ic.o(.text+0xbd7): In function `camera_rotate':
: undefined reference to `sin'
/tmp/cc5mi2Ic.o(.text+0xd9b): In function `camera_calcNormal':
: undefined reference to `sqrt'
/tmp/cc5mi2Ic.o(.text+0xe51): In function `sTree_resizeWindow':
: undefined reference to `gluPerspective'
/tmp/cc5mi2Ic.o(.text+0xf07): In function `sTree_display':
: undefined reference to `gluLookAt'
/tmp/cc5mi2Ic.o(.text+0x1d1e): In function `sTree_gaussian':
: undefined reference to `pow'
/tmp/cc5mi2Ic.o(.text+0x1d30): In function `sTree_gaussian':
: undefined reference to `sqrt'
/tmp/cc5mi2Ic.o(.text+0x1d59): In function `sTree_gaussian':
: undefined reference to `pow'
/tmp/cc5mi2Ic.o(.text+0x1d86): In function `sTree_gaussian':
: undefined reference to `pow'
/tmp/cc5mi2Ic.o(.text+0x1d9a): In function `sTree_gaussian':
: undefined reference to `exp'
/tmp/cc5mi2Ic.o(.text+0x29f8): In function `sInfo_resizeWindow':
: undefined reference to `gluOrtho2D'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libglut.so: undefined reference to `gluErrorString'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libglut.so: undefined reference to `gluCylinder'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libglut.so: undefined reference to `gluQuadricNormals'
collect2: ld returned 1 exit status

I use the following to compile:

gcc -o tree main.c -lglut  -L/usr/X11R6/lib -lXi -lXmu -lGL

And the header files i include are:

#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

I guess i must be missing a library or else something to do with the actual compile line.

Can someone please help as i am stuck and need this to compile, did most on windows but used mainly C and no windows functions, basically i have geared it all to linux, in as much as i can.

Cheers for any assistance.

Add -lGLU -lm in your gcc line.

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