Compiling C ++ 11 sources for Android NDK

I am trying to compile some C ++ 11 sources with Android NDK on Windows, but without much luck. Please note that I read some other questions about C ++ 11 compilation, but they, unfortunately, did not help much.

I downloaded the ADT Bundle and the latest NDK ( android-ndk-r9b-windows-x86.zip).

These are my configuration files:

Application.mk

APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION = 4.8
LOCAL_CPP_FEATURES += exceptions
LOCAL_CFLAGS += -std=c++11

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := procalc-core

LOCAL_SRC_FILES := pcc_arithmetics.cpp \
pcc_arithmetics_tools.cpp \
pcc_common.cpp \
pcc_core.cpp \
pcc_dms_tokenizer.cpp \
pcc_dynamic_numerics.cpp \
pcc_exceptions.cpp \
pcc_expressiontree.cpp \
pcc_expression_containers.cpp \
pcc_messages.cpp \
pcc_numerics.cpp \
pcc_resolvers.cpp \
pcc_syntaxtree.cpp \
pcc_tokenizer.cpp \
sm_Bignum.cpp \
sm_Math2D.cpp \
sm_MathNumerics.cpp \
ss_Streams.cpp

include $(BUILD_SHARED_LIBRARY)

Build team

cd %AndroidProjects%ProCalc\jni\
D:\Android\ndk\ndk-build

pause

Error
This is actually one of the errors, but it clearly does not recognize new C ++ 11 keywords, such as autoor nullptr.

D:/(path)/jni/pcc_arithmetics.cpp: In static member function 'static 
ProCalcCore::BaseNumeric* (* ProCalcCore::Arithmetics::GetFunctionMethod(std::string))
(const std::vector<const ProCalcCore::BaseNumeric*>&)': 
D:/(path)/jni/pcc_arithmetics.cpp:4077:11: error: 'nullptr' was not declared in 
this scope

return nullptr;
       ^

What am I doing wrong?

+4
source share
1 answer
LOCAL_CPP_FEATURES += exceptions
LOCAL_CFLAGS += -std=c++11

Must enter Android.mk file. Alternatively, you can supply

APP_CFLAGS += -std=c++11

Application.mk. APP_CPPFLAGS, C ( ) ( C -std=c++11).

+8

All Articles