What is the problem?

I bought Perpetual license.
The code I ran was:

#include <nuitrack/Nuitrack.h>

#include <iomanip>
#include <iostream>

using std::cout;
using std::endl;

using namespace tdv::nuitrack;

void showHelpInfo()
{
	std::cout << "Usage: nuitrack_console_sample [path/to/nuitrack.config]" << std::endl;
}

// Callback for the hand data update event
void onHandUpdate(HandTrackerData::Ptr handData)
{
    if (!handData)
    {
        // No hand data
        std::cout << "No hand data" << std::endl;
        return;
    }

    auto userHands = handData->getUsersHands();
    if (userHands.empty())
    {
        // No user hands
        return;
    }

    auto rightHand = userHands[0].rightHand;
    if (!rightHand)
    {
        // No right hand
        std::cout << "Right hand of the first user is not found" << std::endl;
        return;
    }

    std::cout << std::fixed << std::setprecision(3);
    std::cout << "Right hand position: "
                 "x = " << rightHand->xReal << ", "
                 "y = " << rightHand->yReal << ", "
                 "z = " << rightHand->zReal << std::endl;
}

int main(int argc, char* argv[])
{
    showHelpInfo();

    std::string configPath = "C:\\Program Files\\Nuitrack\\nuitrack\\nuitrack\\data\\nuitrack.config";
	cout << "configPath : " << configPath << endl;

    // Initialize Nuitrack
    try
    {
        Nuitrack::init(configPath);
    }
    catch (const Exception& e)
    {
        std::cerr << "Can not initialize Nuitrack (ExceptionType: " << e.type() << ")" << std::endl;
        return EXIT_FAILURE;
    }
    
    // Create HandTracker module, other required modules will be
    // created automatically
    auto handTracker = HandTracker::create();

    // Connect onHandUpdate callback to receive hand tracking data
    handTracker->connectOnUpdate(onHandUpdate);

    // Start Nuitrack
    try
    {
        Nuitrack::run();
    }
    catch (const Exception& e)
    {
        std::cerr << "Can not start Nuitrack (ExceptionType: " << e.type() << ")" << std::endl;
        return EXIT_FAILURE;
    }

    int errorCode = EXIT_SUCCESS;
    while (true)
    {
        try
        {
            // Wait for new hand tracking data
            Nuitrack::waitUpdate(handTracker);
        }
        catch (LicenseNotAcquiredException& e)
        {
            std::cerr << "LicenseNotAcquired exception (ExceptionType: " << e.type() << ")" << std::endl;
            errorCode = EXIT_FAILURE;
            break;
        }
        catch (const Exception& e)
        { 
            std::cerr << "Nuitrack update failed (ExceptionType: " << e.type() << ")" << std::endl;
            errorCode = EXIT_FAILURE;
        }
    }

    // Release Nuitrack
    try
    {
        Nuitrack::release();
    }
    catch (const Exception& e)
    {
        std::cerr << "Nuitrack release failed (ExceptionType: " << e.type() << ")" << std::endl;
        errorCode = EXIT_FAILURE;
    }

    return errorCode;
}

Here is the result and I got error:

Usage: nuitrack_console_sample [path/to/nuitrack.config]
configPath : C:\Program Files\Nuitrack\nuitrack\nuitrack\data\nuitrack.config
Create DepthProvider: Realsense2DepthProvider
LicenseNotAcquired exception (ExceptionType: 6)

Actually My initial setting is perfect.

  1. environment variable setting,
  2. C:\Program Files\Nuitrack\nuitrack\nuitrack\activation_tool execute and license registration
  3. Execute the code above.

What is the problem?

Hi devLupin,

Sorry for a late reply.

This error occurred because you specified the path to nuitrack.config. Please check our docs to find more info about the Nuitrack::init function:

Do not specify the config value as it’s set automatically. Specify the path to nuitrack.config only if the default location of nuitrack.config (defined after the installation of Nuitrack runtime) was changed.

I’ll check. Thank you!

@olga.kuzminykh