
qn1551020088


0 访问量
0 原创专栏
0 资料
0 粉丝
个性签名:此E友还没有留下个性签名哦~
加入易百纳时间:2019-02-24
-
请问大神,为什么用交叉编译工具编译会报这个错误呢?不是支持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; ^2019-04-110 0 2641
-
RT,每次加载到图片的位置就重启,恳求大神解救2019-03-031 0 3161

共2条