ndk支持STL

实例

Android.mk:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=main.cpp
LOCAL_MODULE:= test-stl
include $(BUILD_EXECUTABLE)

 

Application.mk

APP_ABI:=armeabi
APP_STL := stlport_static

 

main.cpp

#include <new>
#include <map>
#include <iostream>
int main()
{
std::map<int ,int>a;
a[1] = 2;
std::cout<<a[1];
return 0;
}

ndk-build V=1 查看一下

/home/sonic/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -Wl,--gc-sections -Wl,-z,nocopyreloc --sysroot=/home/sonic/android-ndk-r6/platforms/android-3/arch-arm /home/sonic/android-ndk-r6/samples/test-stl/obj/local/armeabi/objs/test-stl/main.o /home/sonic/android-ndk-r6/samples/test-stl/obj/local/armeabi/libstlport_static.a -Wl,--no-undefined -Wl,-z,noexecstack -L/home/sonic/android-ndk-r6/platforms/android-3/arch-arm/usr/lib -lstdc++ -lc -lm -lsupc++ -o /home/sonic/android-ndk-r6/samples/test-stl/obj/local/armeabi/test-stl

 

你可能感兴趣的:(NDK)