Search code examples
androidc++android-ndkgoogle-project-tango

Tango compilation issues with mutex


I'm trying to compile the Tango examples (from here) with Android Studio and the NDK, but I keep running getting the following error:

Error:(96, 8) error: 'mutex' in namespace 'std' does not name a type

from the line

std::mutex pose_mutex_;

I'm using the latest GitHub release with the necessary libraries included. I've checked the Android.mk file and see that it compiles with the c++11 flag and another simple C++ program I wrote compiles just fine with mutex.

I'm still starting with the Tango so I'm struggling with the debugging. Has anyone else had this issue? What am I missing?


Solution

  • I managed to answer my own question.

    The Application.mk given in the example project has the line

        APP_STL := gnustl_static
    

    Apparently this support library does not have Mutex support. Changing it to

        APP_STL := c++_static
    

    seems to have fixed it and it compiles and runs happily now.