I’m a Computer Games Tech student, so in my free time I like to think about/attempt making hobbyist games. I don’t want to go down the Python route as some people suggest, because that’s of no use to me in the future – the games industry is built on C++. As such, earlier today I pulled out my OpenGL book now that my university work is finished, hoping to go through an exercise or two. Turns out it was annoyingly hard to get everything set up playing nicely together, as every guide appears to be for Windows. So, for anyone trying to do this themselves, and for my own reference in the future, here’s how I got everything playing nice.
First, I installed my IDE of choice – Code::Blocks (version 8.02), available from the repositories. I’m going to assume you can get Code::Blocks set up and compiling C++ yourselves. Once that’s going, you need to link the GLUT/SDL libraries. You only really need GLUT or SDL, but I have both so I have the choice. For this, we need to download and install a few packages – namely freeglut3 and freeglut3-dev for GLUT, and libsdl1.2-dev for SDL. If you want to check out what they installed, GLUT files are installed to /usr/include/GL/, and SDL to /usr/include/SDL.
Second, we need to link CodeBlocks to the correct library files for it to be able to compile GLUT/SDL programs. Open up Code::Blocks, and click through to Settings > Compiler and debugger.., then hit the Linker settings tab. Under ‘Link libraries’, you simply need to add the values “glut” for GLUT, and “SDL“, “GLU” & “GL” for SDL.

That should be everything finished!
To give it a try, have a go running the pieces of code over on http://www.ferdychristant.com/blog/articles/DOMM-72MPPE, where I found out how to do all this!