How to use the examples from these libraries ?

I want to use this library in one of my projects or more like use one of the examples.
I am new to openframeworks would i just include .h file or do i have to import the library somewhere within my OF folder?

You need to drop the addon in your addons folder, so wherever you have OF installed, you want to just put the addon in there:


so that you end up with


Since most addons are done using relative paths to everything, you should just be able to run them from the examples folder then.

I have done this like so:

but i get these errors when i try to run any of the examples. Do i have to move the examples by any chance to the examples folder of OF? Surly this wont make a difference.

I also had great trouble getting these examples to compile, basically because every set-up requires different steps, and also different users use different approaches to installing add-ons.
I will speak about what works on my personal set-up: Mac OS X 10.7.5, Xcode 3.2.6 and oF v0.7.4.
Maybe I should start a new topic about the use of add-ons, please tell me if that’s the case. Some instructions I’m giving are based informations I found in other topics, but I think some explanations still miss.

To include ANY add-on that you need, basically you have three options (if they apply):

  1. Copy a project that uses all or some of the add-ons you need. The directory examples/addons contains a project called allAddonsExample which contains all of the add-ons shipped with your current version. Please note that you should copy the example AT THE SAME LEVEL of the one that you’re copying (i.e. place it in the same directory and you’re fine).

  2. Use the Project Generator. You can choose any add-on you want (including the ones that you downloaded), but you won’t understand what’s really happening so you might lose some control. For example to run ofxFaceTracker you don’t need to include the folders of ofxOpenCv inside your project, because it would speed down compiling.

  3. Create a new project (usually by copying an Empty Project) and insert the add-ons one by one. Usually every add-on requires to do it in a different way. The typical case is that you just have to drag and drop the folder of your add-on but in most cases you will have to tell the compiler where to find some additional folders.

Here you will find a step-by-step guide on how to add the add-ons you need for FaceTracker examples to work.

  1. ofxOpenCv: you will need this add-on in order to get the ofxCv add-on to work. You don’t need to drag&drop the add-on files unless you need to use the add-on for your project, so you just need to add some paths to your project.
    Under Group&Files click on the name of your app and hit cmd + I.
    Inside the “Project Info” menu, select Build, and type header in the search field. Double click on “Header Search Paths” and add these paths:
  • …/…/…/addons/ofxOpenCv/src
  • …/…/…/addons/ofxOpenCv/libs/opencv/include
  • …/…/…/addons/ofxOpenCv/libs/opencv/include/opencv

Now close the last window and type “Link” in the search field. Double click on “Other Linker Flags” and add this path:


  • …/…/…/addons/ofxOpenCv/libs/opencv/lib/osx/opencv.a
  1. ofxCv: drag and drop the folder containing the add-on. Select the option “Recursively create groups for any added folder”. You only need the libs and src folder, so feel free to delete all of the example files. (If asked, when deleting, choose “delete only references”).
    Add an header search path as you did in the first step, but with this path:
    [tt]- …/…/…/addons/ofxCv/libs/ofxCv/include/[/tt]

  2. ofxFaceTracker: drag and drop the folders in the same way you did in step 2.
    Add this Header Search Path:
    [tt]- …/…/…/addons/ofxFaceTracker/libs/FaceTracker/include/[/tt]

Note: you could add these paths just by selecting Project.xconfing file, but I did it this way so I’m sure about how you can make it.

Add-ons in general
To check if any of the add-ons you’re using is actually working you just need to import its main .h file and declare one of its variables in your testApp.h (or any name you gave it) file.
Like this
[tt]#include “ofxFaceTracker.h”[/tt]
and then
[tt]ofxFaceTracker tracker;[/tt]
If the app builds without any error then you’re fine.

Once you’ve created your project copy the files from the src folder of the example projects into your src folder. (Or open the example projects and copy the parts that you wish).
Kyle McDonald’s examples declare
[tt]using namespace ofxCv;
using namespace cv;[/tt]
in the .h file and
[tt]using namespace ofxCv;[/tt]
in the .cpp file. I’m not exactly sure about what namespaces are used for, but you need to add this to create your own projects.
Inside the /libs folder of FaceTracker add-on you will find a /model folder. Be sure to include this folder inside every bin/data folder of your projects (this is clearly explained in the file included, but just to be sure…).
Some of the example files miss the necessary include statements, so don’t forget to ALWAYS include ofxCv.h and ofxFaceTracker.h.

Bonus: ofxOsc
I don’t know if it’s me or what but I always have a bad time with add-ons: to have the blink example work you need the ofxOsc. Other than drag and drop the files you have to add some “Header Search Paths”, so I put the ones I found in the install.xml file but they didn’t work: instead of
you need to just insert

Anyway you can also just use the Project generator and it will just work.
Last note: if you use the Project Generator to create your project, just remember to take off the ofxOpenCv folder from your project (unless you really need it) because it just speeds down the building process.