现在的位置: 首页 > 综合 > 正文

Android NDK 调用c++ stl 模板库(修改android.mk文件)

2013年04月22日 ⁄ 综合 ⁄ 共 455字 ⁄ 字号 评论关闭

1  在需要调用模板库的文件前包含头文件:

   #include <iostream>
  #include <vector>
 
  此时编译可能不过,需要在android.mk文件内添加:
  
LOCAL_C_INCLUDES :=   /home/administrator/android-ndk-r5b/sources/cxx-stl/stlport/stlport     (ndk安装路径下的stl库)


 2  在 mk 文件前加入:

   APP_STL  :=  stlprot_static    (模板库以静态库的方式添加)

  ....
  LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib  -llog \
 /home/administrator/android-ndk-r5b/sources/cxx-stl/stlport/libs/armeabi/libstlport_static.a

抱歉!评论已关闭.