Skip to content
⚡ Developer documentation for INFINICAM, the real-time high-speed camera (UC-1.1 / GbE-2)

Creating the HelloWorld Project

You create a C++ console app in Visual Studio, set up the INFINICAM SDK (PUCLIB), and write a program that detects and connects to the camera and shows its serial number.

  1. Create a new project

    1. Start Visual Studio and choose “Create a new project”.
    2. From the template list, choose “Console App” (C++ / Windows / Console) and click “Next”.
    3. Enter HelloWorld as the project name and C:\infinicam_projects as the location, check “Place solution and project in the same directory”, and click “Create”. Avoid folders with non-ASCII characters or spaces, and folders synced by OneDrive or similar (for the reasons, see notes on where to save).
  2. Set the platform to x64

    Set the platform box in the toolbar at the top of the window to x64.

  3. Open the properties window

    From the menu at the top of the window, choose “Project” > “HelloWorld Properties” (your own project name appears in place of “HelloWorld”). At the top of the window, set “Configuration” to “All Configurations” and “Platform” to “x64” (if it shows “Active(x64)”, you can leave it as it is).

  4. Header file location (C/C++ > General)

    Enter the following in “Additional Include Directories”.

    C:\infinicam_sdk\include
  5. Read source files as UTF-8 (C/C++ > Command Line)

    Enter the following in “Additional Options”. It is needed when your source code contains non-ASCII text, such as the Japanese comments in the sample code bundle.

    /utf-8
  6. Library location and name (Linker)

    • Enter the following in “Additional Library Directories” under “Linker” > “General”.

      C:\infinicam_sdk\lib
    • Add the following to the start of “Additional Dependencies” under “Linker” > “Input”.

      PUCLIB.lib;
  7. Copy the DLLs automatically (Build Events)

    Enter the following in “Command Line” under “Build Events” > “Post-Build Event”, then close with “Apply” > “OK”.

    xcopy /Y /D "C:\infinicam_sdk\dll\*.dll" "$(OutDir)"
  8. Enter the source code

    Open the .cpp file with the same name as the project (for example HelloWorld.cpp) and replace its contents with the following code.

    #include <stdio.h>
    #include <stdlib.h>
    #include <PUCLIB.h> // INFINICAM SDK header
    int main()
    {
    printf("Initializing INFINICAM...\n");
    // 1. Initialize the SDK
    PUCRESULT ret = PUC_Initialize();
    if (ret != PUC_SUCCEEDED) {
    printf("Error: failed to initialize the SDK. ErrorCode: %d\n", ret);
    return EXIT_FAILURE;
    }
    // 2. Search for connected cameras
    PUC_DETECT_FILTER filter = { 0 };
    filter.nDeviceTypeFlags = PUC_DETECT_TARGET_ALL; // Search for both UC-1.1 and GbE-2
    PUC_DETECT_INFO detectInfo = { 0 };
    ret = PUC_DetectDevice2(&filter, &detectInfo);
    if (ret != PUC_SUCCEEDED || detectInfo.nDeviceCount == 0) {
    printf("Error: no camera was found. ErrorCode: %d\n", ret);
    printf("Check the cable connection and the network settings.\n");
    return EXIT_FAILURE;
    }
    printf("Camera detected. (count: %u)\n", detectInfo.nDeviceCount);
    // 3. Open the first camera found
    PUC_HANDLE hDevice = NULL;
    ret = PUC_OpenDevice2(0, &hDevice);
    if (ret != PUC_SUCCEEDED) {
    printf("Error: could not open the camera. ErrorCode: %d\n", ret);
    return EXIT_FAILURE;
    }
    printf("SUCCESS: connected to the camera!\n");
    // 4. Show camera information
    UINT64 serialNo = 0;
    if (PUC_GetSerialNo(hDevice, &serialNo) == PUC_SUCCEEDED) {
    printf("Serial number: %llu\n", serialNo);
    }
    // 5. Close the camera
    PUC_CloseDevice(hDevice);
    return EXIT_SUCCESS;
    }
  9. Connect the camera and run it

    Connect the camera to the PC and press Ctrl + F5 (Start Without Debugging). If you see the following, it worked.

    Initializing INFINICAM...
    Camera detected. (count: 1)
    SUCCESS: connected to the camera!
    Serial number: (your camera's serial number)