Android - Can I use STL with Vuforia

May 13, 2013 - 7:41am #1

The Standard Template Library (STL) is a very popular and commonly used C++ library. The Vuforia samples do not use the STL, however it is possible to integrate it in the existing samples and build your custom application using such library.

In order to enable the STL support (in Android), make sure to:

  • edit the file and add the following:
    • APP_STL := stlport_static
  • or alternatively:
    • APP_STL := stlport_shared
  • add the necessary STL include files (e.g. for std::vector, std::list, std::string, ...), as required by your application code, for instance: 
#include <vector>
#include <list>
#include <string>

Remember to always declare the STL variables with the 'std::' namespace prefix (e.g. std::vector, std::string, std::list), or otherwise add "using namespace std;'.

Don't forget to always rebuild your native code with ndk-build.

Topic locked