Mark
Mark

Reputation: 6494

g++ -- missing array header

The following simple code can't be compiled by 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. Is there another option?

Thanks.

Upvotes: 1

Views: 3898

Answers (2)

Gillespie
Gillespie

Reputation: 6561

For me the problem was that it was a cross compiler that needed to be told where the sysroot was, and supplying --sysroot=<path to sysroot> allowed GCC to find the headers

Upvotes: 0

Carl Norum
Carl Norum

Reputation: 225112

GCC 4.3 and presumably also your C++ library are too old for the support you're looking for. 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.

Alternatively, clang supports all of C++11 with libc++.

Upvotes: 2

Related Questions