配置visual studio 2017运行Leap Motion的Example

配置visual studio 2017运行Leap Motion的Example

  • 1. 设置环境变量
  • 2. 在visual studio 2017中新建一个项目
  • 3. 配置项目属性
  • 4. 添加代码
  • 5. 运行

1. 设置环境变量

配置visual studio 2017运行Leap Motion的Example_第1张图片
LeapSDK是从Leap Motion官网下载的。

2. 在visual studio 2017中新建一个项目

选择 “Windows桌面向导”。
配置visual studio 2017运行Leap Motion的Example_第2张图片
取消勾选 “预编译标头”。
配置visual studio 2017运行Leap Motion的Example_第3张图片
这样就新建了一个不包含预编译标头的控制台应用程序。

3. 配置项目属性

配置visual studio 2017运行Leap Motion的Example_第4张图片
修改 “C/C++” 中的 “附加包含目录”,输入 $(LEAP_SDK)\include
配置visual studio 2017运行Leap Motion的Example_第5张图片
配置visual studio 2017运行Leap Motion的Example_第6张图片
修改 “链接器” 的 “常规” 中的 “附加库目录”,输入 $(LEAP_SDK)\lib\x86
配置visual studio 2017运行Leap Motion的Example_第7张图片
配置visual studio 2017运行Leap Motion的Example_第8张图片
修改 “链接器” 的 “输入” 中的 “附加依赖项”,输入 $(LEAP_SDK)\lib\x86\LeapC.lib
配置visual studio 2017运行Leap Motion的Example_第9张图片
配置visual studio 2017运行Leap Motion的Example_第10张图片
修改 “生成事件” 的 “生成后事件” 中的 “命令行”,输入 xcopy /yr "$(LEAP_SDK)\lib\x86\LeapC.dll" "$(TargetDir)"
配置visual studio 2017运行Leap Motion的Example_第11张图片
配置visual studio 2017运行Leap Motion的Example_第12张图片
项目属性配置完成。

4. 添加代码

先移除项目生成的代码 “Example.cpp”。
配置visual studio 2017运行Leap Motion的Example_第13张图片
再把 LeapSDK\samples 中的 CallbackSample.cExampleConnection.hExampleConnecion.c 添加到项目中。
配置visual studio 2017运行Leap Motion的Example_第14张图片
配置visual studio 2017运行Leap Motion的Example_第15张图片

5. 运行


可以看到结果。
配置visual studio 2017运行Leap Motion的Example_第16张图片

你可能感兴趣的:(Leap,Motion)