Register / Login

openframeworks – linux codeblocks & makefiles

codeblocks

Codeblocks is a fairly nice IDE for writing code on linux, and we are happy to support it. Here are some setup instructions for ubuntu, debian and fedora. If you use other distributions please let us know if there are additional steps:

  • in the scripts folder inside the openframeworks package you will find a directory with the name of your distribution. There’re 2 scripts, install_codeblocks.sh and install_dependencies.sh. don’t execute them from the desktop, as they need root privileges to run, you will need to run them from a terminal. The order of execution doesn’t matter and you can execute them more than once without problem if something goes wrong. If you update your OF version or are having problems with codeblocks execute both scripts. Once you finish this steps, you will find codeblocks under Applications > Development and will be able to open the openframeworks examples in the apps folder just by double clicking on the .cbp file
  • ubuntu:
    open a terminal from Applications > Accesories > Terminal
    in the terminal go to the directory where your openframeworks package is.
    ie. if your user name is ofuser and you have uncompressed the oF package in the desktop it should be something like:

    cd /home/ofuser/Desktop/of_preRelease_v0.06_linux_cb_FAT/scripts/ubuntu

    once in this directory run the scripts with:

    sudo ./install_codeblocks.sh
    sudo ./install_dependencies.sh

    problems with karmic: if you were having problems with installing codeblocks, that’s solved with the new install script, but if you already ran the previous one perhaps you need to clean your apt cache:

    sudo rm /var/cache/apt/archives/libwxbase*
    sudo rm /var/cache/apt/archives/libwxgtk*
    sudo apt-get remove libwxbase2.8-0 libwxgtk2.8-0

    and execute again the install_codeblocks script. this will remove any program that you have installed that uses wx-widgets, but you can install them later without problem.

  • debian:
    open a terminal from Applications > Accesories > Root Terminal
    in the terminal go to the directory where your openframeworks package is.
    ie. if your user name is ofuser and you have uncompressed the oF package in the desktop it should be something like:

    cd /home/ofuser/Desktop/of_preRelease_v0.06_linux_cb_FAT/scripts/debian

    once in this directory run the scripts with:

    ./install_codeblocks.sh
    ./install_dependencies.sh
  • fedora:
    open a terminal from Applications > System Tools > Terminal
    in fedora first of all you need to become root, for that, type in the terminal:

    su -

    and enter the root password
    in the terminal go to the directory where your openframeworks package is.
    ie. if your user name is ofuser and you have uncompressed the oF package in the desktop it should be something like:

    cd /home/ofuser/Desktop/of_preRelease_v0.06_linux_cb_FAT/scripts/fedora

    once in this directory run the scripts with:

    ./install_codeblocks.sh
    ./install_dependencies.sh

makefiles

From 0.06 there’s makefiles for all the examples. There’s no special package, the makefiles are in the codeblocks distribution.

You only need to execute the install_dependencies script in case you don’t want to use codeblocks. Follow the instructions for your platform in the codeblocks install.

To use the makefiles just enter the example directory from a console and type make. It will compile everything and generate the executable and the clickToLaunch.sh script in the bin directory the same as with codeblocks.

The make targets are:

Debug: to generate the executable with debug symbols
Release: to generate the executable with compiler optimizations
clean: to clean the objects and executable
CleanDebug: cleans only the debug build
CleanRelease: cleans only the release build
help: shows the help message on how to use the makefile

0061 new makefile: The makefile has been updated in 0061, now it autodetects the project file name, source files… so you can just make a copy of any example, rename the folder and it will work. The behaviour of the makefile can be tweaked editing just 4 variables, at the beginning of the file, everything else should work automatically.

Also you can tell the makefile to include addons just by creating an addons.make file in the root of your project, just put the names of the addons that you want to use and it will do the rest.

To execute the examples from outside codeblocks use the clickToLaunch.sh script inside bin.