I want to write a simple SDL OpenGL app, Codeblocks is the IDE I use.
When I create a new OpenGL project, it compiles fine, but if I try to use a function from the SDL header, le wild “undefined reference error” occurs. The same goes for the other direction, if I create a new SDL project, I can use the SDL functions without problems but I get a “undefined reference error” for the OpenGL functions…
NOTES:
- I Use Ubuntu 11.10
- I have installed the SDL and the OpenGL packages
You need to add the correct library. Headers just give the compiler sort of a index. But you need to tell the linker which libraries to actually pull in. You should find the linker options at the build settings. You need the following libraries for SDL + OpenGL
-lGLlinker switch )-lSDLlinker switch)You may also require libGLU.so if you’re using glu… functions.