To ensure that Visual Studio can find the PixeLINK API header files and import library, it is recommended that you make use of the PIXELINK_SDK_ROOT environment variable that was created when you installed the SDK. 

Please note that this article assumes you already have an existing C/C++ project in Visual Studio.


Adding The Include Directory


Go to the Visual Studio Project Property Pages dialog (From the Project menu, select Properties, or right-click on the project in the Solution Explorer). Select Configuration Properties, C/C++, General, and then add $(PIXELINK_SDK_ROOT)\include; to the beginning of the Additional Include Directories field.


For example:




In the above example, we have added the dir to all configurations for our project ('getcamerafeature').


Now that this directory is added, in your code you can include the header file(s) using


#include <PixeLINKApi.h>


and the compiler will find it in the include path.


Adding The Import Library 


When linking, you'll have to link in the API's DLL import library, PxLApi40.lib, so that the project knows how to use PxLApi40.dll.


Go to the Project Property Pages dialog, Configuration Properties, Linker, General, add $(PIXELINK_SDK_ROOT)\lib to the Additional Library Directories.


e.g.



In the above example, we've added the library directory to all configurations for our project ('getcamerafeature').


Now that this directory is added, you have to specify that you want the import library linked in.


Go to the Project Property Pages dialog, Configuration Properties, Linker, Input, add PxLApi40.lib to the list of Additional Dependencies to be linked in.


e.g.



A Note on Configuration


In the last two screenshots, "All Configurations" was chosen so that our changes would affect all configurations (Debug, Release), but if you have an existing project and there are differences between the two configurations, it is best to make the changes to each individual configuration rather than change all configurations at the same time.



You can also view the C and C++ code samples, included with the SDK, to view how those projects are configured. And if you have any further questions or issues with this, please contact Pixelink Support



Troubleshooting


"I don't see the C/C++ option in the Configuration Properties"

Pleas ensure the project you are selecting is a C/C++ project. If you are trying to set these configurations while you are working in a project in a different language (for example, C#), then you will not see the same Property Pages window. 


"I don't see the Linker option in the Configuration Properties"

Please ensure that you are selecting the properties of the project, not the solution or the individual files. Please see the image below - the item which you need to right click and select properties of is highlighted in red. 


"I cannot create a C/C++ project in Visual Studio"

Visual Studio does not always have the C/C++ packages installed by default. If you do not have the option to create C/C++ projects and files, then you will need to install the supporting packages. Please refer to Microsoft support pages for more information on how to do this. 


"MFC libraries are required for this project": Some of the samples use MFC libraries, which are not installed by default in Visual Studio. If you receive the error "MFC libraries are required for this project" when you try to build the project, then please see the MSBuild error MSB8041 Microsoft support page to resolve it.