I've been following the guide microsoft have made for setting up the Kinect SDK with c++. The steps they have created are as follows.
- Include windows.h in your source code.
- To use the NUI API, include MSR_NuiApi.h. Location: Program Files\Microsoft Research KinectSDK\inc
- To use the Kinect Audio API, include MSRKinectAudio.h. Location: Program Files\Microsoft Research KinectSDK\inc
- Link to MSRKinectNUI.lib. Location: Program Files\Microsoft Research KinectSDK\lib
- Ensure that the beta SDK DLLs are on your path when you run your project. Location: \Program Files\Microsoft Research KinectSDK
I believe I've done everything apart from step 5. Could anyone give me more details on what this means and how to do this?
thanks in advance, John
To do this, you probably want to add that path to your project
;C:\Program Files\Microsoft Research KinectSDK\inc
to the end of the include paths;C:\Program Files\Microsoft Research KinectSDK\lib
to the end of the libraries pathsthen add
to the includes at top of your source file. If you're using precompiled headers then you should put it below the stdafx.h include, or just add it to stdafx.h instead.
This means that your binary needs to be able to find these files at runtime.
The easiest way to do this is to add them to your system path; go to
;
then the path givenYou may then need to restart Visual Studio to pick this up, or it should be registered when you open a new command prompt.
Or, if you don't want to change the system settings, you can e.g. add it to an open command prompt with
or you can work out exactly which files there are necessary and copy them into the same directory as your binary, etc.
To implement a C++ application
Include
windows.h
in your source code first. (This is important--you can't haveWIN32_LEAN_AND_MEAN
defined anywhere in your project or else you won't be able to compileNuiApi.h
)Include
<NuiApi.h>
in your source code.Make sure you have an environment variable set up for your OS that reflects the SDK file path. The SDK installation should automatically do this for you. Example:
Go to your Visual Studio project settings under VC++ directories. Add
$(KINECTSDK10_DIR)\inc
to the include directories.Under the same VC++ directories area, include
$(KINECTSDK10_DIR)\lib\x86
(for 32-bit apps) or$(KINECTSDK10_DIR)\lib\amd64
(for 64-bit apps) in your libraries directory.We are using the Kinect SDK version 1.0 and this is how the project is configured. Please note that the developer machine is Windows 7 x86. If you are using x64, please change the path accordingly.
Step 1. Copy header files and library. There is a reason to do this: the project can be checked out to any machine and compile just fine (the machine doesn't have to install the SDK). Another benefit: we upgraded the SDK to version 1.0 but because our project hasn't been updated and the deadline is coming, we had to built it with SDK version beta and everything went smoothly.
I suggest you create a new directory in your solution called "3rdparty/KinectSDK" (change it to suit your need).
Copy
C:\Program Files\Microsoft SDKs\Kinect\v1.0\inc
Copy
C:\Program Files\Microsoft SDKs\Kinect\v1.0\lib
(you will have both x86 and x64 libraries)Step 2. Configure the project. You will need to do this for each project that uses Kinect SDK! All configuration is happened in the Project Properties dialog.
C/C++ > General > add "
$(SolutionDir)\3rdparty\KinectSDK\inc
" to your Additional Include DirectoriesLinker > General > add "
$(SolutionDir)\3rdparty\KinectSDK\lib\x86
" to your Additional Library Directories (if you are configuring for x64, use the amd64 directory)Linker > Input > add "
Kinect10.lib
" to Additional DependenciesStep 3. Compile time!
Note:
Good luck.