Setting Up OpenFrameworks with Code::Blocks


By daniel - Posted on 12 September 2009

I just got setup with OpenFrameworks which is sort of the C++ version of the popular Processing engine. OpenFrameworks launched fairly recently so I had a few kinks getting up and running. Hopefully this helps.

I'm using Code::Blocks as my editor, and OpenFrameworks prerelease v0.06 on Windows XP. At the end of the tutorial you'll have compiled and run an OpenFrameworks application that does nothing. Fortunately, it doesn't die spewing errors either. (-;

Downloads

Here's what you'll need get your first application up and running.

  • Code::Blocks editor with MinGW. It's important that you get the version that's packaged with the MinGW compiler.
  • OpenFrameworks. Make sure you get the Code::Blocks version.
  • OpenFrameworks additions for Code::Blocks. This contains a bunch of files you need to copy into Code::Blocks' "/includes" and "/libs" directories.
  • A test project. It's based on the "emptyExample" sample app, including some DLLs I had to download separately. The ".cbp" project file assumes you installed OpenFrameworks to "C:/openframeworks" but you can change this using a text editor.

Installing OpenFrameworks and Code::Blocks

Okay, so you can get most of the way there by following the OpenFrameworks for Code::Blocks setup guide. I wish I'd seen this before. (-:

Once you've gone through the guide, make sure Code::Blocks knows where to find the MinGW compiler by opening the "Settings" menu and choosing "Compiler and debugger...". Under the "Toolchain executables" tab you'll find the installation directory. Make sure this points to a folder which contains "bin/mingw32-gcc.exe".

Now you can unzip the test project archive. If you installed OpenFrameworks in a directory other than "c:/openframeworks" you'll need to update "first.cbp" with the correct location. Find and replace in a text editor will do the trick.

You're ready to run the project. Open the workspace file and hit "Build" and you should be good to go!

If that doesn't work, you can always visit the OpenFrameworks forum.