Using open gl on ubuntu

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

You need to link to the OpenGL libraries.
most likely they are:
/usr/lib/i386-linux-gnu/libGLU.so
/usr/lib/libGL.so

Simpler: just add -lGL to the link line.

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