How to Compile C++14 code for Android?

此生再无相见时 提交于 2019-12-04 02:46:21

I use android-ndk-r12b-windows-x86_64, compile success with -std=c++14

Android.mk

LOCAL_CPPFLAGS  = -Wall -std=c++14

If someone needs an answer to this question, I have found it here.

It's called CrystaX and basically it is a modified version of the Android NDK that allows targeting C++14, Boost libraries and has a number of other features.

I'm using the following directives in my Application.mk. Switching to the clang toolchain via NDK_TOOLCHAIN_VERSION solved a bunch of problems.

APP_CPPFLAGS += -std=c++14
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION := clang

If I use c++_static as my APP_STL, i get the following error:

User/someone/Software/Android/android-ndk-r10d/platforms/android-17/arch-arm/usr/include/locale.h:55:1: error: empty struct has size 0 in C, size 1 in C++

I'm getting the same when I'm using iostream. But this is only a warning (I'm using NDK 10e) and it builds just fine. The warning is "-Wextern-c-compat" which you could turn off just like any other warning.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!