Reputation: 98
I tried making use of some OpenGL-functions in Eclipse C/C++. some "standard" functions as GlClear are recognized by eclipse, others like glBindBuffer() and glEnableVertexAttribArray() aren't. They are just underlined in red.
However compilation is succesful, there's just this disturbing underlining..
I have linked glut, GL, GLU and GLEW and my operating system is arch linux. I use eclipse 3.7.2
What do I have to do additionally to avoid these errors?
Upvotes: 7
Views: 4318
Reputation: 106
Underlining means C++ Indexer doesn't recognise a symbol. Check if this helps:
How can I get Eclipse to index code inside #ifdef .... #endif
In order to use OpenGL 2.0 functions I had defined GL_GLEXT_PROTOTYPES symbol in the source file, but the Indexer wasn't picking it up. It had to be defined in project settings, under: Project Properties > C/C++ General > Paths & Symbols. Then after rebuilding the index the errors disappeared.
Upvotes: 3
Reputation: 126
Try right-click your project and in the popup menu: Index > Rebuild
Upvotes: 11
Reputation: 1501
If you're using the Eclipse CDT to actually build your project, the easiest solution is to let Eclipse automatically learn your include paths from the build process.
In your project properties, go to C/C++ Build->Discovery Options, and check the box that says "Automate discovery of paths and symbols".
glBindBuffer() and glEnableVertexAttribArray() are declared in GL/glext.h, not in GL/gl.h. If you put the cursor on the line with your #include <GL/gl.h>, right-click it, and select "Open Declaration", Eclipse should open the header it thinks is the header. Your implementation may or may not automatically include <GL/glext.h> in <GL/gl.h>; it's worth checking.
Upvotes: 0