ndk c++11 编译的坑

代码如下

#include <future>
#include <exception>
#include <typeinfo>
#include <stdio.h>
using namespace std;
void f()
{
	printf("exec f\n");
}
int TestCpp11()
{
	std::this_thread::sleep_for(std::chrono::seconds(10));
	auto fu = async(launch::async, f);
	return 0;
}

Application.mk中

APP_ABI := armeabi

怎么都编译不过,提示

jni/main.cpp: In function 'int TestCpp11()':
jni/main.cpp:17:34: error: invalid use of incomplete type 'class std::future<void>'
  auto fu = async(launch::async, f);
                                  ^
In file included from jni/main.cpp:1:0:
D:/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/future:114:11: error: declaration of 'class std::future<void>'

     class future;

 

把APP_ABI 的值改为armeabi-v7a后编译通过,c++11需要gcc4.7以上才支持,armeabi的gcc版本应该是比较低不支持导致编译失败。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值