config.make and USER_CFLAG

i’m using OF under ubuntu withoud codeblocks, only makefile.
for compiling ofxOpenNi i have to add more paths in the makefile.
i’ve tried to add -Ifoo/new_path in config.make but i have no result.

so i’ve added -Ifoo/new_path directly in USER_CFLAG in the makefile
but i have a lot of compilation undefined reference error in almoust every lib: poco, xml, opencv, openni, sound libs

i think i’ve added some erros too.
anyone could give me some advice please?

the best practice to add an addon to your proect is:
create a file in your project root called addons.make
add every addon with its name in a seperate line.
your addons.make would have one line with
in it.

thanks but only in this way the compiler doenn’t find the .h in ofxOpenNi/include

ok, you are right, you have to add the search paths to your config.make manually.
for example:

USER_CFLAGS = -I…/path/to/the/addon

this is what i have done but i get really a lot of
undefined reference error
so i think there is something wrong.

some more help?

is your openframeworks installed right? did you run script from of/scripts/linux/your_distro ?

jeah, and i’ve just redone it…
edit: well, thanks you! if this one is the correct way to do it mayebe my error is somewhere else

if the addon has the standard file system structure it should work just by having it in the addons folder and adding ofxOpenNI to addons.make. The directories should look something like:


with the libraries are in .a binaries inside libs/openNI/lib/linux or linux64 if you are in linux 64

if the code for the openNI library is directly included in the addon then the file system structure should look like:


or just


with the source code files in libs/openNI/src or in libs/openNI

the errors you are getting are not related with the include paths, that seem to be right since you are getting till the linking phase, what you are missing are the libraries, if you want to do it manually apart from the -I in USER_CFLAGS you need to include the libraries in USER_LDFLAGS or USER_LIBS

ok arturo thanks for your clear explanations. what i missed was USER_LDFLASG and USER_LIBS.
i’ve seen a real good example from patriciogonzales that has a good makefile and a really good structure for source files (openNI is included in the of project not in the addon).

what i do not understand it is why the linker (is it a linker problem?) did not find also all other OF libs like poco, ofImage, sound, opencv, etc…
there was a problem in importing openNI libs… what happened to all others?

(sorry for my bad english please!)

did you have your application in apps/somefolder/projectfolder? if not you need to specify the path to OF in config.make in the OF_ROOT variable

i have ofpath/apps/my_apps/openni_test