1.配置NDK路径 NDKROOT
project->properties->c/c++ build->environment ,点击ADD 设置name为"NDKROOT",value 值为NDK路径,我的为"/Applications/android/android-ndk-r10b"
2.修改Android.mk
添加
#导入本地C++库,STL支持,此句最重要
LOCAL_C_INCLUDES +=
${NDKROOT}/sources/cxx-stl/stlport/stlport
APP_STL :=
stlport_shared
3.可能会报错"undefined reference to ‘std::__node_alloc::_M_deallocate(void*, unsigned int)"
解决办法:
修改Android.mk
添加
LOCAL_CFLAGS := \
‘-D_STLP_USE_NEWALLOC‘
时间: 2024-10-30 20:54:18