[英]Android NDK C++ stlport
Currently I'm using NDK-r10c with C++11 support through gnustl. 目前我通过gnustl使用NDK-r10c和C ++ 11支持。 Unfortunately our project need to switch to stlport. 不幸的是我们的项目需要切换到stlport。 While changing from gnustl to stlport many errors raised during compilation. 从gnustl更改为stlport时,在编译期间引发了许多错误。 Below is Application.mk file. 下面是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
It seems that C++11 features are not available: - cbegin(), cend() on vectors - data() on vectors, - cannot deduce auto from cbegin(), etc. 似乎C ++ 11的功能不可用: - 矢量上的cbegin(),cend() - 矢量上的data(), - 不能从cbegin()等推断出auto。
STLport is just too old and does not support C++11 at all. STLport太旧了,完全不支持C ++ 11。
Flags like -std=c++11 will affect the compiler only, not necessarily the STL implementation. 像-std = c ++ 11这样的标志只会影响编译器,不一定会影响STL实现。
You will have to use either gnustl or libc++ 您将不得不使用gnustl或libc ++
To use stlport you will need add these lines in your Android.mk 要使用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.