简体   繁体   English

g++ — 缺少数组头

[英]g++ — missing array header

The following simple code can't be compiled by g++ 4.3:下面的简单代码不能被 g++ 4.3 编译:

#include <array>

using namespace std;

int main()
{
    std::array<int, 8> myarray;

    return 0;
}

array: No such file or directory数组:没有那个文件或目录

Also, the compiler doesn't seen to understand option '-std=c++11' as is recommended to provide to the compiler.此外,编译器没有看到建议提供给编译器的选项“-std=c++11”。 Is there another option?还有其他选择吗?

Thanks.谢谢。

GCC 4.3 and presumably also your C++ library are too old for the support you're looking for. GCC 4.3 可能还有您的 C++ 库对于您正在寻找的支持来说太旧了。 You need a newer version.您需要更新的版本。 Here's a link to the GCC C++11 support page , and another link to the libstdc++ C++11 support page .这是GCC C++11 支持页面的链接,以及 libstdc++ C++11 支持页面的另一个链接

Alternatively, clang supports all of C++11 with libc++ .或者, clang支持所有带有libc++的 C++11。

对我来说,问题是它是一个交叉编译器,需要被告知--sysroot=<path to sysroot>在哪里,并且提供--sysroot=<path to sysroot>允许 GCC 找到头文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM