Linking error when using NuiSkeletonSetTrackedSkeletons - Kinect SDK RRS feed

  • General discussion

  • I just wanted to point out that I get a link error when using the NuiSkeletonSetTrackedSkeletons function.  However, using the INuiSensor::NuiSkeletonSetTrackedSkeletons method works like a charm (well, links, haven't had a chance to try it out yet).

    Error encountered:

    error LNK2019: unresolved external symbol __imp__NuiSkeletonSetTrackedSkeletons@4 referenced in function "some function"

    Any ideas as to when this will be added in? :)

    Thursday, May 3, 2012 6:28 PM

All replies

  • I just ran into the same thing.  It would really be nice if this is supported in the NUI APIs without having to convert to INuiSensor.
    Friday, May 4, 2012 12:12 AM
  • Yup - sorry about that, we accidentally dropped that export from the list of flat C APIs.  Happily, the INuiSensor version works just fine, and since the flat C APIs are just wrappers around the INuiSensor code, here's a drop-in replacement for you, if you still wish to use the flat API:

    _Check_return_ HRESULT _NuiSkeletonSetTrackedSkeletons(
        int count;
        if ( SUCCEEDED( NuiGetSensorCount(&count) ) )
            for (int i = 0; i < count; i++)
                INuiSensor* pSensor;
                if ( SUCCEEDED( NuiCreateSensorByIndex(i, &pSensor) ) )
                    if ( (pSensor->NuiInitializationFlags() & NUI_INITIALIZE_FLAG_USES_SKELETON) != 0 )
                        hr = pSensor->NuiSkeletonSetTrackedSkeletons(TrackingIDs);
                        i = count; // force loop to end after this iteration
        return hr;

    Hope this helps!

    -Adam Smith [MSFT]

    Saturday, May 5, 2012 6:16 AM
  • Thanks!  Given the code that you just showed I'm guessing that NuiCreateSensorByIndex isn't a very costly function to call?

    Monday, May 7, 2012 3:44 PM
  • Indeed.  It's not free, but (basically) it's looking up into an ordered table, add-ref'ing the existing sensor and returning it. 

    Of course, it could still go a bit faster if you hang on to the INuiSensor yourself for further calls.

    -Adam Smith [MSFT]

    Tuesday, May 8, 2012 12:54 AM
  • Perfect, thanks! :)
    Tuesday, May 8, 2012 2:10 PM