How to open tutorials in codeblocks in ubuntu - cant find ofMain.h

I installed openframeworks with codeblocks from github, when I import one of the tutorials projects it can’t find ofMain.h.

Is there a particular way I should be opening these tutorials, or do I need to tell codeblocks where to find OF?

g++  -I/mnt/data/home/stu/projects/external/openFrameworks -c /mnt/data/home/stu/projects/external/openFrameworks/examples/video/videoPlayerExample/src/main.cpp -o /mnt/data/home/stu/projects/external/openFrameworks/examples/video/videoPlayerExample/src/main.o
/mnt/data/home/stu/projects/external/openFrameworks/examples/video/videoPlayerExample/src/main.cpp:1:20: fatal error: ofMain.h: No such file or directory
 #include "ofMain.h"
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Hi @stuaxo Did you create the cb project with the ProjectGenerator or how?

For that one I just imported the files. Since then I’ve got the project generator working. I’m really just want to know how to load one of the examples into codeblocks, there are “.project” files, but I don’t know how to open that with codeblocks.

Also… the script to compileAllExamples - doesn’t seem to leave any binaries anywhere (?).

To try the examples, do I need to generate a new project first ?

.project file is used by eclipse ide, instead .cbp and .workspace file are used by codeblocks ide. follow this guide if you are using linux, and to use ProjectGenerator this [tutorial][2].

[2]:[quote=“stuaxo, post:3, topic:15927”]
Also… the script to compileAllExamples - doesn’t seem to leave any binaries anywhere (?).

i think that script was valid for the previous versions 006, you need to use the projectGenerator to generate the project.

The instructions say “… open the openFrameworks examples in the apps folder just by double clicking on the .cbp file”

But I can’t work out which cbp to open, I thought there might be one in each example directory ?

Here are all the .cpb files I can find:

$ find . | grep .cbp

No, you have to create them with the ProjectGenerator, the guide assumed that you have yet build the projects within PG (Project Generator). I think this part of the guide is a bit outdated (maybe referring to previuos versions). The project files are not included anymore, in github because the download became huge. You can also download the .zip file with all the example project files did you see this page? There are .zip files for every OS (windows, linux, mac, arm)…

Ah OK … so basically … foreach (example I want to try) … use project generator, then I guess I need to copy the source into the newly generated file ?

I saw that page, but since it was a tar.gz I preferred to just build from source.

Got a bit confused as it’s a bit diffferent to the last time I tried OF a couple of years ago.

Having said this, will just use the download since it appears projects are all setup, can understand not putting them in git, it was quite large to clone.

Cheers for the info :smile:

no,for example you want to create the codeblocks project file for the color example (located in the graphics examples) just open the PG, point the path to


and set the name of the project


and click generate project, you will find the .cbp .workspace and config.make makefile, the files in the src folder will not touched. It is different if you generate an entire new project, in this case also files in src folder are created, but i think you will find all this info in the tut.
and @stuaxo welcome back to OF you will discover a lot of more feature in it!

But if you want to try the tutorials example those are only on github… you will not find them on the zipped version!

Thanks, that example is really good - it might be worth including in one of the READMEs - I had no idea project generator was for the existing examples as well as new ones.

Although I’ve a lot of experience in development, C++ is new, as is the codeblocks IDE and OF - so lots to learn.