NDK r10b和c ++ 11功能

时间:2014-11-20 08:56:21

标签: android c++11 makefile android-ndk

在阅读了很多关于Make和NDK的帖子后,我仍然无法获得c ++ 11支持。

在我的Application.mk文件中:

NDK_TOOLCHAIN_VERSION := clang
APP_CPPFLAGS += -std=c++11
APP_STL := gnustl_static
APP_BUILD_SCRIPT := Android.mk 

然后在我的Android.mk文件中:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Core

# =======================================================================
#                       Includes Directories
# =======================================================================
LOCAL_C_INCLUDES := ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/include
LOCAL_C_INCLUDES += ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/Include

# Boost:
LOCAL_C_INCLUDES += $(BOOST_PATH)

# Python:
LOCAL_C_INCLUDES += $(PYTHON_PATH)

# Core Includes: 
LOCAL_C_INCLUDES += $(LOCAL_PATH)/Core

LOCAL_SRC_FILES :=  /Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.cpp

include $(BUILD_STATIC_LIBRARY)

然后在ndk-build日志中我有这样的信息:

  

包含在/Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/gnu-libstdc++/4.8/include/initializer_list:36:0的文件中,                    来自/Sources/Boost-for-Android-master/boost_1_53_0/boost/smart_ptr/make_shared_array.hpp:18,                    来自/Sources/Boost-for-Android-master/boost_1_53_0/boost/smart_ptr/make_shared.hpp:18,                    来自/Sources/Boost-for-Android-master/boost_1_53_0/boost/make_shared.hpp:15,                    来自/Sources/FluxV3/Sources/DotFlux/Core/OSMin.hpp:114,                    来自/Sources/FluxV3/Sources/DotFlux/CoreDef.hpp:34,                    来自/Sources/FluxV3/Sources/DotFlux/CoreMin.hpp:26,                    来自/Sources/FluxV3/Sources/DotFlux/CoreBase.hpp:26,                    来自/Sources/FluxV3/Sources/DotFlux/Core.hpp:26,                    来自/Sources/FluxV3/Sources/DotFlux/Core/PCH/pch.hpp:24,                    来自/Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.cpp:21:   /Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/c++0x_warning.h:32:2:错误:#error此文件需要编译器和库支持ISO C ++ 2011标准。此支持目前是实验性的,必须使用-std = c ++ 11或-std = gnu ++ 11编译器选项启用..

另一件事是我没有将 Android 预处理程序引入我的代码。

任何帮助都会很好。 感谢。

编辑:

  

/Sources/Android/SDK/android-ndk-r10b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++,MMD -MP -MF ./obj /local/armeabi/objs/Core//Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.od -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march = armv5te - mtune = xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit = 64 -I / Sources / FluxV3 / Sources / DotFlux / Core -I / Sources / FluxV3 / Sources / DotFlux / Core / PCH -I / Sources / Boost-for-Android-master / boost_1_53_0 -I / Sources / Android / SDK / android-ndk-r10b / sources / cxx- stl / gnu-libstdc ++ / 4.8 / include -I / Sources / Android / SDK / android-ndk-r10b / sources / cxx-stl / gnu-libstdc ++ / 4.8 / libs / armeabi / Include -I / Sources / Android / SDK / android-ndk-r10b / sources / cxx-stl / system / include -I / Sources / FluxV3 / Sources / DotFlux -DANDROID -Wa, - noexecstack -Wformat -Werror = format-security -std = c ++ 11 -pthread -I /来源/安卓/ SDK / android- ndk-r10b / platforms / android-3 / arch-arm / usr / include -c /Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.cpp -o ./obj/local/armeabi/objs/Core//来源/ FluxV3 / Sources / DotFlux / Core / Application / AppBase.o

我们看到std = c ++ 11和-pthread已设置。

1 个答案:

答案 0 :(得分:1)

我从user1906回答:

"检查您的Application.mk文件。尽管它将clang设置为工具链,但正在使用的编译器是GCC 4.6(来自上一次编辑)。尝试将工具链设置为4.8并查看它是否发生了任何变化。 "