Jump to content

have a problem compiling C program with GLUT


Recommended Posts

I wrote some program for my CG class using GLUT in Microsoft Visual Studio 6.0. It works on Windows but doesn't want to work on linux. I have GLUT installed on Mandriva2009, yet GCC gives me errors:

 

$ gcc ex2.c
ex2.c: In function ‘main’:
ex2.c:45: warning: return type of ‘main’ is not ‘int’
/home/ilia/tmp/ccMxXfmm.o: In function `main':
ex2.c:(.text+0xe1): undefined reference to `glutInitWindowPosition'
ex2.c:(.text+0xf5): undefined reference to `glutInitWindowSize'
ex2.c:(.text+0x101): undefined reference to `glutInitDisplayMode'
ex2.c:(.text+0x10d): undefined reference to `glutCreateWindow'
ex2.c:(.text+0x119): undefined reference to `glutReshapeFunc'
ex2.c:(.text+0x126): undefined reference to `glutDisplayFunc'
ex2.c:(.text+0x12b): undefined reference to `glutMainLoop'
/home/ilia/tmp/ccMxXfmm.o: In function `drawBonus':
ex2.c:(.text+0x159): undefined reference to `glColor3f'
ex2.c:(.text+0x165): undefined reference to `glBegin'
ex2.c:(.text+0x17b): undefined reference to `glVertex2f'
ex2.c:(.text+0x191): undefined reference to `glVertex2f'
ex2.c:(.text+0x1a7): undefined reference to `glVertex2f'
ex2.c:(.text+0x1bd): undefined reference to `glVertex2f'
ex2.c:(.text+0x1c2): undefined reference to `glEnd'
ex2.c:(.text+0x1e1): undefined reference to `glColor3f'
ex2.c:(.text+0x1ee): undefined reference to `glLineWidth'
ex2.c:(.text+0x1fa): undefined reference to `glBegin'
ex2.c:(.text+0x210): undefined reference to `glVertex2f'
ex2.c:(.text+0x226): undefined reference to `glVertex2f'
ex2.c:(.text+0x22b): undefined reference to `glEnd'
/home/ilia/tmp/ccMxXfmm.o: In function `drawCircle':
ex2.c:(.text+0x2fa): undefined reference to `glColor3f'
ex2.c:(.text+0x31b): undefined reference to `glColor3f'
ex2.c:(.text+0x327): undefined reference to `glBegin'
ex2.c:(.text+0x34b): undefined reference to `cos'
ex2.c:(.text+0x375): undefined reference to `sin'
ex2.c:(.text+0x390): undefined reference to `glVertex2f'
ex2.c:(.text+0x3a2): undefined reference to `glEnd'
/home/ilia/tmp/ccMxXfmm.o: In function `AspectRatio':
ex2.c:(.text+0x3f7): undefined reference to `glViewport'
ex2.c:(.text+0x3fc): undefined reference to `glLoadIdentity'
ex2.c:(.text+0x434): undefined reference to `gluOrtho2D'
ex2.c:(.text+0x460): undefined reference to `gluOrtho2D'
/home/ilia/tmp/ccMxXfmm.o: In function `RenderCallBack':
ex2.c:(.text+0x490): undefined reference to `glClearColor'
ex2.c:(.text+0x49c): undefined reference to `glClear'
ex2.c:(.text+0x4be): undefined reference to `glFlush'
/home/ilia/tmp/ccMxXfmm.o: In function `drawShapes':
ex2.c:(.text+0x507): undefined reference to `glColor3f'
ex2.c:(.text+0x526): undefined reference to `glBegin'
ex2.c:(.text+0x534): undefined reference to `glBegin'
ex2.c:(.text+0x587): undefined reference to `glVertex2f'
ex2.c:(.text+0x5a0): undefined reference to `glEnd'
ex2.c:(.text+0x5cd): undefined reference to `glColor3f'
ex2.c:(.text+0x5da): undefined reference to `glLineWidth'
ex2.c:(.text+0x5ef): undefined reference to `glBegin'
ex2.c:(.text+0x642): undefined reference to `glVertex2f'
ex2.c:(.text+0x65b): undefined reference to `glEnd'
collect2: ld returned 1 exit status

It seems like the compiler (gcc) doesn't know where to look for some gl and glut functions even though i've included 'glut.h' header.

 

I'll be glad to get some help on it.

Edited by ilia_kr
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...