Template:PT3 C WIN VS 2

From Phidgets Support
Revision as of 21:33, 8 March 2021 by Mparadis (talk | contribs) (Created page with "<div class="phd-slide-deck" data-deck="PT3_C_WIN_VS_2"> <div class="phd-slide-deck-header"><h3>Visual Studio New Project</h3></div> <div class="phd-slides"> <div class="phd-sl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Setting up a New Project

When using Phidgets in a Visual Studio project, you need to properly link the Phidget C library.

1. First, create a new Win32 Console Application:

Setting up a New Project

2. Select an empty project and Finish:

Setting up a New Project

3. If you are using a 64-bit machine, select x64, otherwise, select x86:

Setting up a New Project

4. Next, right click on the source folder and click New Item:

Setting up a New Project

5. Give the source file a name and click Add:

Setting up a New Project

6. Right click your project and access its properties:

Setting up a New Project

7. Go to Configuration Properties -> C/C++ -> General and add this to the additional include directories:

C:\Program Files\Phidgets\Phidget22

Setting up a New Project

8. Go to Configuration Properties -> Linker -> Input and add the appropriate line to additional dependencies:

C:\Program Files\Phidgets\Phidget22\phidget22.lib (for 64-bit systems)

C:\Program Files\Phidgets\Phidget22\x86\phidget22.lib (for 32-bit systems)

Setting up a New Project

9. Lastly, include the Phidget library at the beginning of your program:

#include < phidget22.h >

Success! The project now has access to Phidgets.

What's Next?

Now that you've set up Phidgets in your C programming environment, you should read our guide on Phidget Programming Basics to learn the fundamentals of programming with Phidgets.

In particular, you should ensure that you familiarize yourself with how error handling is done in C, because it's not automatically implemented like in other programming languages. Once you've added error handling to your code, you can use the Error Code List to anticipate and handle various errors.

Continue down below for advanced information and troubleshooting for your device.

«
»