This section describes how to set the environment for developing your own applications using OpenNI.
Windows: To Create a simple project that uses OpenNI in Visual Studio:
- Open a new project or an existing one with which you want to use OpenNI.
- In the Visual Studio menu, open the Project menu and choose Project properties.
- In the C/C++ section, under the General node, find the "Additional Include Directories" and add "$(OPEN_NI_INCLUDE)". This is an environment variable pointing to where OpenNI include directory is located (the default location will be: C:\Program files\OpenNI\Include).
- In the Linker section, under the General node, find the "Additional Library Directories" and add "$(OPEN_NI_LIB)". This is an environment variable pointing to where OpenNI libraries directory is located (the default location will be: C:\Program files\OpenNI\Lib).
- In the Linker section, under the Input node, find the "Additional Dependencies" and add OpenNI.lib
- If you wish to use an XML file to configure OpenNI, you can start from a basic one found under OpenNI Data folder (the default location will be: C:\Program files\OpenNI\Data). For additional information about OpenNI xml scripts, see Xml Scripts.
- Make sure to add the Additional Include and Library directories to both your Release and Debug configurations.
- Your code files should include XnOpenNI.h if using the C interface, or XnCppWrapper.h if using the C++ interface.
Linux: Compiling an application that uses OpenNI using gcc:
During compilation, the following arguments should be passed to gcc:
- Add OpenNI include files to the include dirs: -I/usr/include/ni
- Add OpenNI library to the linkage process: -lOpenNI
- If you wish to use an XML file to configure OpenNI, you can start from a basic one found under the Samples directory
- Go to the directory from which OpenNI was installed.
- Go to Samples/Config
- Use the SamplesConfig.xml file as a reference. For additional information about OpenNI xml scripts, see Xml Scripts.
- Your code files should include XnOpenNI.h if using the C interface, or XnCppWrapper.h if using the C++ interface.