Unable to compile OpenGL/C program

Arvind S Raj sraj.arvind at gmail.com
Fri Oct 28 10:19:06 UTC 2011


Hello everyone,
I had visited #opengl on freenode yesterday and they seemed to be stumped
about the issue too so thought I'd ask here as well.

I'm running Kubuntu 11.04 64bit and have installed the packages
libgl1-mesa-dev, libglu1-mesa-dev and freeglut3-dev.

I'm trying to compile the following program -> http://pastebin.com/PhiLayVQ.

and these are the errors I get. I'm guessing the libraries can't be found or
something?

$ alias glc
alias glc='gcc -lm -lglut -lGL -lGLU'
$ glc 1_basic.c
/tmp/ccN3AU7G.o: In function `main':
1_basic.c:(.text+0x1e): undefined reference to `glutInit'
1_basic.c:(.text+0x28): undefined reference to `glutInitDisplayMode'
1_basic.c:(.text+0x37): undefined reference to `glutInitWindowSize'
1_basic.c:(.text+0x46): undefined reference to `glutInitWindowPosition'
1_basic.c:(.text+0x50): undefined reference to `glutCreateWindow'
1_basic.c:(.text+0x5d): undefined reference to `glutDisplayFunc'
1_basic.c:(.text+0x67): undefined reference to `glutMouseFunc'
1_basic.c:(.text+0x71): undefined reference to `glutMainLoop'
/tmp/ccN3AU7G.o: In function `myDisplay':
1_basic.c:(.text+0x86): undefined reference to `glClear'
1_basic.c:(.text+0x99): undefined reference to `glColor3f'
1_basic.c:(.text+0x9e): undefined reference to `glFlush'
/tmp/ccN3AU7G.o: In function `myInit':
1_basic.c:(.text+0xc4): undefined reference to `glClearColor'
1_basic.c:(.text+0xe1): undefined reference to `glColor3f'
1_basic.c:(.text+0xee): undefined reference to `glPointSize'
1_basic.c:(.text+0xf8): undefined reference to `glMatrixMode'
1_basic.c:(.text+0xfd): undefined reference to `glLoadIdentity'
1_basic.c:(.text+0x122): undefined reference to `gluOrtho2D'
/tmp/ccN3AU7G.o: In function `myMouse':
1_basic.c:(.text+0x184): undefined reference to `glFlush'
/tmp/ccN3AU7G.o: In function `plotPoint':
1_basic.c:(.text+0x1d7): undefined reference to `glBegin'


1_basic.c:(.text+0x1e6): undefined reference to `glVertex2i'


1_basic.c:(.text+0x1eb): undefined reference to `glEnd'


collect2: ld returned 1 exit status

I've been unable to find out what is wrong. It'll be great if I can get some
help regarding this.

-- 
Arvind S Raj

B.Tech, Computer Science and Engineering(Final Year)
Amrita School of Engineering, Amritapuri

http://arvindsraj.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20111028/69fa2c9d/attachment.html>


More information about the ubuntu-users mailing list