How to get OfxOpenNI to work on Linux?

To make OpenNI work, I did the following:

Now, when I go to this project and try to compile it using

make

I a lot of undefined reference, for instance this:

ofxOpenNI.cpp:(.text._ZN2xn12NodeInfoList8IteratorC2E22XnNodeInfoListIterator[_ZN2xn12NodeInfoList8IteratorC5E22XnNodeInfoListIterator]+0x3c): undefined reference to `xnNodeInfoListIteratorIsValid'

I know this is a linking error. How do I fix it?

1 Like

On further inspection, I saw that there is no -lOpenNI flag in compilation. I added it to config.make, but it doesn’t work. Where should I include the openNI folder? (the project has been generated by the projectGenerator).

You could also try ofxNI2.

I actually have some old code in ofxOpenNI, so I have to try and get it to work. I am not using code::blocks. Is there a way to fix the linker issue without using an IDE?

This can be done in addon_config.mk or in config.make.
Here is an example:

I actually need to to be ofxOpenNI specifically as I need to run some old code that uses it. Any idea how can I do that?
All I have done till now is copied ofxOpenNI directory into the addons directory, and installed OpenNI and NITE. What else is to be done to make basic examples of ofxOpenNI work?

Sorry, I cannot test it right now.
But I would restructure the addon:
Move includes/* to addon_root/libs/include. So includes are added automatically.
And add an addon_config.mk, including the following

linux64:
        # binary libraries, these will be usually parsed from the file system but some 
        # libraries need to passed to the linker in a specific order 
        ADDON_LDFLAGS = -L/path/to/your/lib/ #/usr/lib
        ADDON_LDFLAGS += -lOpenNI
        ADDON_LDFLAGS += -lNiTE

ofxOpenNI depends also on NiTE, which I do not know where to download, since apple bought PrimeSense.

1 Like

That was it! It worked like a charm! Thank you :smile: