FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 10-28-2011, 10:19 AM
Arvind S Raj
 
Default Unable to compile OpenGL/C program

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 glcalias 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


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 10-28-2011, 10:29 AM
Tony Arnold
 
Default Unable to compile OpenGL/C program

Arvind,

On 28/10/11 11:19, Arvind S Raj wrote:

> $ alias glc
> alias glc='gcc -lm -lglut -lGL -lGLU'
> $ glc 1_basic.c

You need to put the libraries after the source file so:

gcc 1_basic.c -lm -lglut -lGL -lGLU

With the use of the alias, the source file is coming after the libraries.

Regards,
Tony.
--
Tony Arnold, Tel: +44 (0) 161 275 6093
Head of IT Security, Fax: +44 (0) 705 344 3082
University of Manchester, Mob: +44 (0) 773 330 0039
Manchester M13 9PL. Email: tony.arnold@manchester.ac.uk

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 10:33 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org