NDK无法包含std的头文件(string,list等)的解决方法

原文:http://stackoverflow.com/questions/4893403/cant-include-c-headers-like-vector-in-android-ndk
一句话:出了在Application.mk中添加 APP_STL := stlport_static,还有修改代码文件后缀:将.c修改为cpp

It is possible. Here is some step by step:

In $PROJECT_DIR/jni/Application.mk:

APP_STL                 := stlport_static

I tried using stlport_shared, but no luck. Same with libstdc++.

In $PROJECT_DIR/jni/Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.cpp
LOCAL_LDLIBS    :=-llog

include $(BUILD_SHARED_LIBRARY)

Nothing special here, but make sure your files are .cpp.

posted on 2012-12-09 22:15  玄冬  阅读(1919)  评论(0编辑  收藏  举报