2641
- 收藏
- 点赞
- 分享
- 举报
NUC972 交叉编译出错,不支持future?
请问大神,为什么用交叉编译工具编译会报这个错误呢?不是支持c++11的吗?
源码:
// future example
#include // std::cout
#include // std::async, std::future
#include // std::chrono::milliseconds
// a non-optimized way of checking for prime numbers:
bool
is_prime(int x)
{
for (int i = 2; i < x; ++i)
if (x % i == 0)
return false;
return true;
}
int main()
{
// call function asynchronously:
std::future < bool > fut = std::async(is_prime, 444444443);
// do something while waiting for function to set future:
std::cout << "checking, please wait";
std::chrono::milliseconds span(100);
while (fut.wait_for(span) == std::future_status::timeout)
std::cout << '.';
bool x = fut.get(); // retrieve return value
std::cout << "\n444444443 " << (x ? "is" : "is not") << " prime.\n";
return 0;
}
编译选项:arm-linux-g++ future.cpp -lpthread -std=c++11
出错内容:
future.cpp: In function ‘int main()’:
future.cpp:19:26: error: variable ‘std::future fut’ has initializer but incomplete type
std::future < bool > fut = std::async(is_prime, 444444443);
^
future.cpp:19:62: error: invalid use of incomplete type ‘class std::future’
std::future < bool > fut = std::async(is_prime, 444444443);
^
In file included from future.cpp:3:0:
/usr/local/arm_linux_4.8/arm-nuvoton-linux-uclibceabi/include/c++/4.8.4/future:113:11: error: declaration of ‘class std::future’
class future;
^
源码:
// future example
#include
#include
#include
// a non-optimized way of checking for prime numbers:
bool
is_prime(int x)
{
for (int i = 2; i < x; ++i)
if (x % i == 0)
return false;
return true;
}
int main()
{
// call function asynchronously:
std::future < bool > fut = std::async(is_prime, 444444443);
// do something while waiting for function to set future:
std::cout << "checking, please wait";
std::chrono::milliseconds span(100);
while (fut.wait_for(span) == std::future_status::timeout)
std::cout << '.';
bool x = fut.get(); // retrieve return value
std::cout << "\n444444443 " << (x ? "is" : "is not") << " prime.\n";
return 0;
}
编译选项:arm-linux-g++ future.cpp -lpthread -std=c++11
出错内容:
future.cpp: In function ‘int main()’:
future.cpp:19:26: error: variable ‘std::future
std::future < bool > fut = std::async(is_prime, 444444443);
^
future.cpp:19:62: error: invalid use of incomplete type ‘class std::future
std::future < bool > fut = std::async(is_prime, 444444443);
^
In file included from future.cpp:3:0:
/usr/local/arm_linux_4.8/arm-nuvoton-linux-uclibceabi/include/c++/4.8.4/future:113:11: error: declaration of ‘class std::future
class future;
^
我来回答
回答0个
时间排序
认可量排序

或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片
相关问答
-
2020-11-13 14:18:01
-
2020-11-12 18:09:59
-
2021-01-05 16:26:38
-
2020-12-02 08:28:20
-
2021-01-07 19:25:12
-
2018-01-20 15:11:19
-
2017-10-30 09:59:24
-
2018-11-26 21:28:30
-
2018-03-16 12:07:19
-
2018-07-12 14:19:30
-
1292017-11-11 20:55:58
-
2018-05-17 12:03:04
-
2017-09-11 20:39:08
-
2017-07-01 13:09:45
-
2018-03-06 15:07:59
-
2020-11-12 18:07:47
-
2017-12-20 00:32:33
-
2021-01-05 16:23:59
-
2019-09-03 10:20:29
无更多相似问答 去提问

点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5DTOF的demo运行时内核挂死
-
10Hi3516DV500+IMX482运行sample_venc,报错:HI_MPI_ISP_MemInit failed with 0xa01c800c!
-
10PQTOOL在调试的时候,出现通讯异常,是不是PQ软件问题?还是什么?
-
5hi3516dv500改了sensor驱动后使用pqtools出图出现彩色的竖条纹
-
10海思3559的VGS模块在VI上画线问题
-
53519dv500接lvds的sensor mn34120,图像出现很多竖线,sensor板接以前的3519v101没问题
-
103403外接hdmi口1024*600显示屏报错
-
5SS928点DC camera的6946,全屏紫色
-
5hi3519 的 网络传输的MTU值可以修改到比1500大嘛?
-
10WS73V100星闪扫描不到设备sle
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认