繁体   English   中英

Android NDK C ++ stlport

[英]Android NDK C++ stlport

目前我通过gnustl使用NDK-r10c和C ++ 11支持。 不幸的是我们的项目需要切换到stlport。 从gnustl更改为stlport时,在编译期间引发了许多错误。 下面是Application.mk文件。

APP_PLATFORM            := android-18 
NDK_TOOLCHAIN_VERSION   := 4.8 
APP_ABI                 := armeabi-v7a 
APP_STL                 := stlport_static
# APP_STL               := gnustl_static 
APP_CPPFLAGS            := -std=c++11 
ifeq ($(NDK_DEBUG),1) 
APP_OPTIM               := debug 
else 
APP_OPTIM               := release
endif

似乎C ++ 11的功能不可用: - 矢量上的cbegin(),cend() - 矢量上的data(), - 不能从cbegin()等推断出auto。

STLport太旧了,完全不支持C ++ 11。

像-std = c ++ 11这样的标志只会影响编译器,不一定会影响STL实现。

您将不得不使用gnustl或libc ++

要使用stlport,您需要在Android.mk中添加这些行

# Need this line to allow use alloc on stl containers
LOCAL_CFLAGS := -D_STLP_USE_NEWALLOC

# c++11 support
LOCAL_CPPFLAGS += -std=c++11

# for stl port
LOCAL_LDLIBS    += -lstdc++

# include stl headers
LOCAL_C_INCLUDES += ${NDK_ROOT}/sources/cxx-stl/stlport/stlport

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM