multithreadingqtc++11openkinect

Use libfreenects waitForNewFrame with timeout on Qt


I have a Qt application which controls 2 Kinects via libfreenect. To access the Kinects, I use one Qt-thread. All works perfectly so far. But I need the program to continue working when one Kinect is disconnected. But if so, the program get stuck in the waitForNewFrame call, even when I specify a timeout parameter. The documentation says, that 'this parameter is ignored if not built with C++11 threading support'.

What must be built with C++11 threading support? Libfreenect or my Qt App?

And how do I build with C++11 threading support?

The Qt App is built with qmake. I have a Global.pri where I can define compiler switches. Compiler is clang but gcc should work too.

Libfreenect is built in an automated build script. It git-clones a fork of libfreenect and executes:

cmake .
make
sudo make install

Solution

  • I found the cause of the problem.

    C++11 needs to be enabled during compilation by adding the -DENABLE_CXX11=ON argument to the cmake command.