目前,我通过gnustl使用带有C++11支持的NDK-r10c。不幸的是,我们的项目需要切换到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()推断自动,等等。
发布于 2014-11-19 12:00:02
STLport太老了,根本不支持C++11。
像-std=c++11这样的标志只会影响编译器,而不一定会影响STL实现。
您必须使用gnustl或libc++。
发布于 2014-11-18 15:15:20
要使用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
https://stackoverflow.com/questions/26978606
复制相似问题