[英]C++11 random library in Android JNI
I am trying to compile an Android app with a native component that uses the C++ random
library. 我正在尝试使用使用C ++ random
库的本机组件编译Android应用程序。
My Application.mk
file is: 我的Application.mk
文件是:
APP_STL := stlport_static
APP_CPPFLAGS += -std=gnu++11
NDK_TOOLCHAIN_VERSION := 4.8
On compilation I get the error: 在编译时我收到错误:
[armeabi] Compile++ thumb: Project <= main.cpp
/home/user/project/main.cpp:12:18: fatal error: random: No such file or directory
#include <random>
Is the random
library available for Android? random
库是否适用于Android?
APP_STL := stlport_static APP_STL:= stlport_static
APP_CPPFLAGS += -std=gnu++11 APP_CPPFLAGS + = -std = gnu ++ 11
NDK_TOOLCHAIN_VERSION := 4.8 NDK_TOOLCHAIN_VERSION:= 4.8
You're building agains STLPort - which as far as I can tell - is a C++03 standard library implementation. 你正在重建STLPort - 据我所知 - 是一个C ++ 03标准库实现。 Hence it won't have C++11 headers. 因此它不会有C ++ 11标头。
Of the other options , you might consider: 在其他选项中 ,您可以考虑:
APP_STL:= gnustl_static
or 要么
APP_STL:= c++_static
Which give you GNU libstd++ or LLVM's libc++ respectively. 它分别为您提供GNU libstd ++或LLVM的libc ++。 If you are concerned about GPL polution to your app (as Google clearly are not using libstd++ by default), use libc++. 如果您担心GPL压缩到您的应用程序(因为谷歌显然没有默认使用libstd ++),请使用libc ++。 You might as well you clang as the compiler as well at this point. 此时你也可以像编译器一样铿锵作响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.