I answer to myself for this issue. In the following the step-by-step process, as described in the settings for V3:
For first, set a new environment variable by Windows System Properties. Search on search bar of Windows "System Properties", click on "System" --> "Advanced system settings" --> "Environment Variables..." and in the "System variables" window, click on "New..." and make a new environment variable:
Variable name: LEAP_SDK
Variable value: path of your LeapSDK (i.e. C:\Users\username\Documents\Libraries\LeapSDK)
Reboot the computer.
Open Visual Studio 2019 --> Create a new project --> Console App --> we can name the project as "LeapTest".
As described in https://developer-archive.leapmotion.com/documentation/cpp/devguide/Project_Setup.html:
- Open the Project Property Pages using the Project > Properties menu command.
- Set up a Debug configuration:
a. Choose the Debug configuration as "Debug" or "Active(Debug)" and Platform as "x64" or "Active(x64)".
b. Add the SDK include directory to your project:
i. Under Configuration Properties, select C/C++ > General.
ii. In the properties pane, add the SDK include directory to the Additional Include Directories field by adding:$(LEAP_SDK)\include
Then:
-
Add references to the Leap Motion libraries:
i. Under Configuration Properties, select Linker > General.
ii. In the properties pane, add the SDK lib\x64 directory to the Additional Library Directories field by adding:
$(LEAP_SDK)\lib\x64
iii. Select Linker > Input
iv. Add LeapC.lib to the Additional Dependencies field.
-
Add a Post-Build Event to copy the Leap Motion libraries to the project’s target executable directory.
i. Under Configuration Properties, select Build Events > Post-Build Event.
ii. Edit the Command Line field to copy the libraries, adding:
xcopy /yr "$(LEAP_SDK)\lib\x64\LeapC.dll" "$(TargetDir)"
Set up a Release configuration:
i. Choose the Release configuration.
ii. Repeat the steps above.
- Add your source code...
Repeat these steps with Debug configuration as "Release".
Let's guess you want to test some sample applications provided by Leap Motion in the LeapSDK/samples. This folder contains several examples of programs to test. Let's test the "ExampleConnection" program.
Go to the LeapTest project created at the beginning, and delete the .cpp file containing the main() function (LeapTest.cpp) because the samples are written in C and this could cause errors as "Unresolved external symbol..." due to the linking of .c objects with a .cpp object. At this point, make a new .c file that will contain the main() function.
On the right pane of Visual Studio, under the project, right-click on LeapTest --> Add... --> Existing Item... and select CallbackSample.c (containing the main() function), ExampleConnection.h and ExampleConnection.c. These files are contained in the LeapSDK/samples folder.
Connect the Leap Motion Controller to the computer, compile and build the solution and run the program.
Remember to build as x64 otherwise you will get the error of LeapC.h not found.
When the program is run, you can stop it by pressing Enter.