std::shared_future on Raspberry Pi toolchain(树莓派工具链上的 std::shared_future)
问题描述
我正在尝试为 Raspberry Pi 交叉编译一个大型项目.我正在使用由 crosstool-ng,gcc 版本 4.7.3 构建的工具链.编译在看到 std::shared_future 时会窒息.我收到此错误:
I'm trying to cross-compile a large project for the Raspberry Pi. I'm using a toolchain built by crosstool-ng, gcc version 4.7.3. The compilation chokes when it sees std::shared_future. I get this error:
test.cpp:5:27: error: aggregate 'std::shared_future<int> xxx' has incomplete type and cannot be defined
这是产生该错误的源文件:
And here's the source file that generates that error:
#include <future>
int main()
{
std::shared_future<int> xxx;
return 0;
}
同样的源文件在 Rapsberry Pi 本身上编译成功.这是交叉工具工具链中的错误吗?有解决方法吗?我怎样才能让它成功编译?
This same source file compiles successfully on the Rapsberry Pi itself. Is this a bug in the crosstool toolchain? Is there a workaround? How can I get this to successfully compile?
推荐答案
我在 @backlash 和 Freenode 上 #gcc 上的人的帮助下解决了这个问题.Crosstool-NG 正在为 armv7 构建工具链,而 Raspberry Pi 的编译器正在为 armv6 编译.将架构级别"(目标选项 > 架构级别)更改为 armv6 允许我编译我原始问题中发布的示例代码.此选项将 --with-arch=armv6 添加到 gcc 的配置标志.希望这对将来有人有所帮助.
I solved this problem with help from @backlash and the people on #gcc on Freenode. Crosstool-NG was building the toolchain for armv7, while the Raspberry Pi's compiler was compiling for armv6. Changing the "Architecture level" (Target options > Architecture level) to armv6 allowed me to compile the sample code posted in my original question. This option adds a --with-arch=armv6 to the configure flags for gcc. Hope this helps someone out in the future.
这篇关于树莓派工具链上的 std::shared_future的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:树莓派工具链上的 std::shared_future
基础教程推荐
- CString 到 char* 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 初始化列表*参数*评估顺序 2021-01-01
