qn1551020088

qn1551020088

0个粉丝

2

问答

0

专栏

0

资料

qn1551020088  发布于  2019-04-11 17:02:41
采纳率 0%
2个问答
2342

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;
           ^
                                            
我来回答
回答0个
时间排序
认可量排序
易百纳技术社区暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
相关问答
无更多相似问答 去提问
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区