Openni2 and ofxNI2 with Visual Studio 2015

Hello everyone!

I’m trying to use ofxNI2 (https://github.com/satoruhiga/ofxNI2), I’ve followed all the steps in the README, but the project won’t compile. It gives me a LNK2019 error and says it can’t find external symbols.

I’m using Windows 8.1, Visual Studio 2015, the master branch ofxNI2 and openframeworks 0.9.0.

I’ve installed OpenNi from here: http://structure.io/openni

Here is what it gives me (truncated because there’s 33 errors):

Erreur	LNK2019	symbole externe non résolu __imp_oniReleaseDeviceList 
référencé dans la fonction "public: static void __cdecl 
openni::OpenNI::enumerateDevices(class openni::Array<class 
openni::DeviceInfo> *)" 
(?enumerateDevices@OpenNI@openni@@SAXPEAV?$Array@VDeviceInfo@openni@@@2@@Z)
	openni	
C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj
	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniInitialize référencé dans la fonction "public: static enum openni::Status __cdecl openni::OpenNI::initialize(void)" (?initialize@OpenNI@openni@@SA?AW4Status@2@XZ)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniGetDeviceList référencé dans la fonction "public: static void __cdecl openni::OpenNI::enumerateDevices(class openni::Array<class openni::DeviceInfo> *)" (?enumerateDevices@OpenNI@openni@@SAXPEAV?$Array@VDeviceInfo@openni@@@2@@Z)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniGetExtendedError référencé dans la fonction "public: static char const * __cdecl openni::OpenNI::getExtendedError(void)" (?getExtendedError@OpenNI@openni@@SAPEBDXZ)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	
Erreur	LNK2001	symbole externe non résolu __imp_oniGetExtendedError	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNiTE2.obj	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniDeviceOpen référencé dans la fonction "public: enum openni::Status __cdecl openni::Device::open(char const *)" (?open@Device@openni@@QEAA?AW4Status@2@PEBD@Z)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniDeviceClose référencé dans la fonction "public: void __cdecl openni::Device::close(void)" (?close@Device@openni@@QEAAXXZ)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniDeviceGetInfo référencé dans la fonction "private: enum openni::Status __cdecl openni::Device::_setHandle(struct _OniDevice *)" (?_setHandle@Device@openni@@AEAA?AW4Status@2@PEAU_OniDevice@@@Z)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	
Erreur	LNK2019	symbole externe non résolu __imp_oniDeviceCreateStream référencé dans la fonction "public: enum openni::Status __cdecl openni::VideoStream::create(class openni::Device const &,enum openni::SensorType)" (?create@VideoStream@openni@@QEAA?AW4Status@2@AEBVDevice@2@W4SensorType@2@@Z)	openni	C:\Users\APOIL\Documents\of_v0.9.0_vs_release\apps\myApps\openni\ofxNI2.obj	1	

etc...

I’m sure i’m missing a simple step, but I can’t get my head around it. Has anyone managed to make it work properly on windows?

Out of curiosity has anyone made it to work on linux?

Thanks.

Ok I managed to make it to compile, I added these to the project:

In Project -> Properties:

  • in C/C++ -> General -> Additional Include Directories : $(OPENNI2_INCLUDE64)
  • in Linker -> General -> Additional Library Directories : $(OPENNI2_LIB64)
  • in Linker -> Input -> Additonal depdendancies : OpenNI2.lib

Now I get a new error:

Exception non gérée à 0x00007FFA60F5871C dans openniTest_debug.exe : 
exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 
0x0000000000000000. 

which points to the code below, and specifically the line with the throw.

	bool assert_error(openni::Status rc)
	{
		if (rc == openni::STATUS_OK) return true;
		ofLogError("ofxNI2") << openni::OpenNI::getExtendedError();
		throw;
	}

I’m a bit lost now.

EDIT:
It was just a part of the example that doesn’t work well with the kinect for some reason. Everything works for now. I also added NiTE to the project using the same steps.