fatal error: vector: No such file or directory

2019-06-21 16:41发布

问题:

I have an Android project comprising of lots of native code in C++. However, I am unable to build my library as it is not able to find out vector.h header file. What could be the issue ? A sample of my inclusions in almost all the pages.

#include <jni.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

The compiler is able to find out all other header files except vector.h in every file. Any suggestions about where am I going wrong ?

NOTE : Filenames end with .cpp and I have already tried #include <vector.h> , #include "vector.h"

Thanks !

回答1:

The issue was finally resolved by creating Application.mk in JNI folder of project and adding the following to it :-

APP_STL := stlport_static

For more details, refer to this question on SO