NDK(18)eclipse 使用C++ STL
1.引用库
在Application.mk 中使用 APP_STL := stlport_static 等.
1 APP_ABI := x86 armeabi 2 APP_PLATFORM := android-15 3 4 #APP_STL := gnustl_static #GNU STL 5 APP_STL := stlport_static 6 APP_CPPFLAGS := -fexceptions -frtti #允许异常功能,及运行时类型识别 7 APP_CPPFLAGS +=-std=c++11 #允许使用c++11的函数等功能 8 APP_CPPFLAGS += -frtti #开启RTTI 9 #APP_CPPFLAGS +=-fpermissive #此项有效时表示宽松的编译形式,比如没有用到的代码中有错误也可以通过编译; 10 #使用GNU STL时不用此项std::string 居然编译不通过!!
APP_STL 的取值有 : 推荐使用 stlport_static
1 system -> Use the default minimal system C++ runtime library. 2 gabi++_static -> Use the GAbi++ runtime as a static library. 3 gabi++_shared -> Use the GAbi++ runtime as a shared library. 4 stlport_static -> Use the STLport runtime as a static library. 5 stlport_shared -> Use the STLport runtime as a shared library. 6 gnustl_static -> Use the GNU STL as a static library. 7 gnustl_shared -> Use the GNU STL as a shared library. 8 c++_static -> Use the LLVM libc++ as a static library. 9 c++_shared -> Use the LLVM libc++ as a shared library.
2.加入头文件
右键项目,Properties ... 加入stl头文件 的include
/home/admin/Android/android-ndk-r10e/sources/cxx-stl/stlport/stlport/
3.使用
使用,注意,这里用的是静态方式,如用动态的,那么要在java中
static{ System.loadLibrary("stl的库"); }
分类:
Android NDK
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 【杂谈】分布式事务——高大上的无用知识?