Setting up a C/C++ development environment
Windows
Section titled “Windows”Installing Visual Studio
Section titled “Installing Visual Studio”To develop in C/C++ on Windows, install “Visual Studio,” Microsoft’s official integrated development environment (IDE).
-
Download the installer
From the Visual Studio official site, download “Visual Studio Community 2022.”
-
Select workloads (features)
Run the downloaded
VisualStudioSetup.exeand check the following item.- Check “Desktop development with C++”
-
Run the installation
Click “Install” in the lower right of the screen.
Creating “Hello World” in C++
Section titled “Creating “Hello World” in C++”Once the installation is complete, let’s write and run an actual C++ program.
-
Launch Visual Studio
Launch Visual Studio. If a sign-in screen appears on first launch, sign in with your university account or a personal Microsoft account, or select “Skip for now” to proceed.
-
Create a new project
- Click “Create a new project” in the lower right of the start screen.
- From the list of templates, select “Empty Project” (Language: C++ / Platform: Windows), then click “Next.”
- Specify a project name (e.g.
Sample01) and save location, then click “Create.”
-
Add a C++ file (.cpp)
- Right-click “Source Files” in the “Solution Explorer” on the right side of the screen.
- Select “Add” > “New Item.”
- Select “C++ File (.cpp)”, confirm the name (e.g.
main.cpp), and click “Add.”
-
Write the code
In the editor for the added
main.cpp, enter the following C++ code.#include <stdio.h>int main(void) {printf("Hello, World!\n");return 0;} -
Run the program
Press
Ctrl+F5(Start Without Debugging) together to run the program.If a black (console) screen appears showing the program’s output, you have succeeded!
Downloading the SDK & placing it in your project
Section titled “Downloading the SDK & placing it in your project”-
Obtain the SDK archive (ZIP)
From this site’s downloads page, download the latest
PUCLIB_SDK.zip. -
Extract the archive
Extract the downloaded ZIP file to a folder of your choice. The extracted folder contains the following files.
include/: Header files (PUCLIB.h,PUCCONST.h,PUCUTIL.h)lib/: Import libraries (PUCLIB.lib,PUCUTIL.lib)dll/: Dynamic libraries for runtime use (PUCLIB.dll,PUCUTIL.dll, etc.)
-
Place the files in your development project
Place the above headers and libraries in the root directory of the C++ project you are creating (or configure the paths to them).
2. Creating a Hello World program
Section titled “2. Creating a Hello World program”This is minimal sample code (main.cpp) that initializes the SDK and performs a connection test.
#include <cstdio>#include "PUCLIB.h"
int main() { printf("--- INFINICAM SDK Initializing ---\n");
// 1. Initialize the SDK PUCRESULT res = PUC_Initialize(); if (PUC_CHK_FAILED(res)) { fprintf(stderr, "SDK initialization failed. Error code: 0x%08X\n", res); return -1; }
// 2. Detect connected devices PUC_DETECT_INFO detectInfo = {0}; res = PUC_DetectDevice(&detectInfo); if (PUC_CHK_FAILED(res)) { fprintf(stderr, "Device detection failed.\n"); return -1; }
printf("Number of INFINICAM devices detected: %u\n", detectInfo.nDeviceCount);
// 3. Open the device (if at least one was detected) if (detectInfo.nDeviceCount > 0) { PUC_HANDLE hDevice = NULL; res = PUC_OpenDevice(0, &hDevice);
if (PUC_CHK_SUCCEEDED(res)) { printf("SUCCESS: Successfully connected to INFINICAM!\n");
// Close the device PUC_CloseDevice(hDevice); } else { fprintf(stderr, "ERROR: Failed to open the device.\n"); } } else { printf("No camera found. Please check the USB or LAN cable connection.\n"); }
return 0;}3. Build settings (Visual Studio example)
Section titled “3. Build settings (Visual Studio example)”When building the project with Visual Studio (MSVC) or similar, configure the following project properties.
| Setting | Example value |
|---|---|
| Additional Include Directories | $(ProjectDir)include |
| Additional Library Directories | $(ProjectDir)lib\x64 |
| Additional Dependencies | PUCLIB.lib |
| Platform | x64 (64-bit required) |
