Visual Studio 2013 and Kinect SDK 2.0 Cannot find or include <NuiApi.h>

筅森魡賤 提交于 2019-12-12 09:01:58

问题


I am learning Kinect development using C++ in Visual Studio 2013 (Desktop version on Windows 8.1). I have downloaded the Kinect SDK 2.0 from Microsoft. According to my understanding, NuiApi.h is part of Kinect SDK 2.0. However, I cannot include it (#include says Cannot open source file). Have searched my computer for the file but couldn't find it. Reinstalled Kinect SDK with no luck. Below is the related part of the code:

#include<iostream>
#include<Windows.h>
#include<kinect.h>
#include<NuiApi.h>

A similar header, NuiKinectFusionApi.h, can be included without a problem.


回答1:


You are mixing the 2 kinect versions!

for the kinect v1, you need to download kinect v1.8 drivers and then use the NuiApi.h

for the kinect v2, you need to download kinect v2.0 drivers and then use the kinect.h




回答2:


You need to follow these steps to include #include.

1)Include windows.h in your source code.

2)To use the NUI API, include MSR_NuiApi.h. Location: Program Files\Microsoft Research KinectSDK\inc To do this, you probably want to add that path to your project

Right-click on your project, properties, VC++ directories

Add ;C:\Program Files\Microsoft Research KinectSDK\inc to the end of the include paths
Add ;C:\Program Files\Microsoft Research KinectSDK\lib to the end of the libraries paths

then add #include <MSR_NuiApi.h> 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.

3) To use the Kinect Audio API, include MSRKinectAudio.h. Location: Program Files\Microsoft Research KinectSDK\inc

4)Link to MSRKinectNUI.lib. Location: Program Files\Microsoft Research KinectSDK\lib

5.Ensure that the beta SDK DLLs are on your path when you run your project. Location: \Program Files\Microsoft Research KinectSDK 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

start menu right-click computer, properties advanced system settings environment variables PATH, in your user or system settings - edit and append ; then the path given You 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

PATH=%PATH%;C:\Program Files\Microsoft Research KinectSDK

or you can work out exactly which files there are necessary and copy them into the same directory as your binary, etc.

Source : Getting the Kinect SDK to work with visual studio 2010 in c++

Hope that helps :)



来源:https://stackoverflow.com/questions/30428719/visual-studio-2013-and-kinect-sdk-2-0-cannot-find-or-include-nuiapi-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!