View Full Version : eclipse - OpenGL not working

December 15th, 2008, 11:03 AM
Hi All,
I just yesterday installed ubuntu on my pc (now I have dual boot with Vista - where open GL works without problem) and when I want to compile one openGL program the compiler can not find open GL. This is what I get on every openGL function (the variable is different):

Description Resource Path Location Type
‘GL_COLOR_BUFFER_BIT’ was not declared in this scope openGLtest.cpp openGLtest/src 28 C/C++ Problem

please where can I define it?

December 15th, 2008, 11:21 AM
Have you included gl.h? ( #include <GL/gl.h> )

December 15th, 2008, 01:13 PM
yes I did...I also checked and gl.h is in the right place (I think) /usr/include/GL

December 15th, 2008, 01:31 PM
You need to link against OpenGL. I believe (not sure) that its GL and possibly GLU as well. If you're using glut make sure to link against that as well. I'm not sure how Eclipse handles adding em in, but through the command line, should be:

gcc yourfile.c -lGL -lGLU -lglut -o yourprog

I'm sure one of the GL guys will be around soon to verify, but give it a try.