让 Kinect SDK 在 c++ 中与 Visual Studio 2010 配合使用
我一直在遵循微软为使用 c++ 设置 Kinect SDK 所做的指南。他们创建的步骤如下。
- 在源代码中包含 windows.h。
- 要使用 NUI API,请包含 MSR_NuiApi.h。 位置:Program Files\Microsoft Research KinectSDK\inc
- 要使用 Kinect 音频 API,请包含 MSRKinectAudio.h。 位置:Program Files\Microsoft Research KinectSDK\inc
- 链接到 MSRKinectNUI.lib。 位置:Program Files\Microsoft Research KinectSDK\lib
- 确保运行项目时 Beta SDK DLL 位于您的路径中。 位置:\Program Files\Microsoft Research KinectSDK
我相信我已经完成了除步骤 5 之外的所有操作。任何人都可以给我更多有关这意味着什么以及如何执行此操作的详细信息吗?
提前致谢, 约翰
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为此,您可能需要将该路径添加到项目中
;C:\Program Files\Microsoft Research KinectSDK\ inc
到包含路径的末尾;C:\Program Files\Microsoft Research KinectSDK\lib
到库路径的末尾,然后添加
到源文件顶部的包含。如果您使用预编译头,那么您应该将其放在 stdafx.h 包含下方,或者只是将其添加到 stdafx.h 中。
这意味着您的二进制文件需要能够在运行时找到这些文件。
最简单的方法是将它们添加到您的系统路径中;转到
;
然后给定的路径您可能需要重新启动 Visual Studio 才能选择此路径起,或者当您打开新的命令提示符时应该注册它。
或者,如果您不想更改系统设置,您可以将其添加到打开的命令提示符中
,或者您可以准确计算出需要哪些文件,并将它们复制到与二进制文件相同的目录中,等等。
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.
要实现 C++ 应用程序,
windows.h
。 (这一点很重要 - 您不能在项目中的任何位置定义WIN32_LEAN_AND_MEAN
,否则您将无法编译NuiApi.h
)包含 < code>在源代码中。
确保您为操作系统设置了反映 SDK 文件路径的环境变量。 SDK 安装应该会自动为您执行此操作。示例:
转到 VC++ 目录下的 Visual Studio 项目设置。将
$(KINECTSDK10_DIR)\inc
添加到包含目录。在同一 VC++ 目录区域下,包含
$(KINECTSDK10_DIR)\lib\x86
(对于 32 位应用程序)或$(KINECTSDK10_DIR)\lib\amd64
(对于 64 位应用程序)在您的库目录中。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.我们使用的是 Kinect SDK 1.0 版,这就是项目的配置方式。请注意,开发人员计算机是 Windows 7 x86。如果您使用的是 x64,请相应更改路径。
第 1 步。复制头文件和库。这样做是有原因的:该项目可以签出到任何机器上并编译得很好(机器不必安装 SDK)。另一个好处是:我们将 SDK 升级到了 1.0 版本,但是因为我们的项目还没有更新,并且截止日期即将到来,所以我们必须使用 SDK 版本 beta 来构建它,一切都很顺利。
我建议您在解决方案中创建一个名为“3rdparty/KinectSDK”的新目录(更改它以满足您的需要)。
复制
C:\Program Files\Microsoft SDKs\Kinect\v1.0\inc
复制C:\Program Files\Microsoft SDKs\Kinect\v1.0\lib (您将同时具有 x86 和 x64 库)
第 2 步。配置项目。您需要为每个使用 Kinect SDK 的项目执行此操作!所有配置都在“项目属性”对话框中进行。
C/C++>一般>将“
$(SolutionDir)\3rdparty\KinectSDK\inc
”添加到您的“附加包含目录链接器”>一般>将“
$(SolutionDir)\3rdparty\KinectSDK\lib\x86
”添加到您的其他库目录(如果您配置的是 x64,请使用 amd64 目录)输入>将“
Kinect10.lib
”添加到其他依赖项第 3 步。编译时间!
注意:
祝你好运。
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.