PDA

View Full Version : using open gl on ubuntu



asdfghjkl
10-09-2012, 09:47 AM
IAM GETTING THESE ERRORS WHEN COMPILING A PROGRAM. CAN U PLZ HELP ME OUT WITH THIS...


user@user-ThinkCentre-M57e:~/Desktop$ g++ 4.cpp -lglut
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glClearColor'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glClear'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glColor3f'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glOrtho'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glBegin'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glVertex2f'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glVertex2f'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glVertex2f'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glVertex2f'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glEnd'
/tmp/ccEmvIhH.o:4.cpp:function renderFunction(): error: undefined reference to 'glFlush'
collect2: ld returned 1 exit status

Snow_56767
10-28-2012, 03:32 PM
You need to link to the OpenGL libraries.
most likely they are:
/usr/lib/i386-linux-gnu/libGLU.so
/usr/lib/libGL.so

Dark Photon
10-28-2012, 06:13 PM
Simpler: just add -lGL to the link line.