MAC OSX 10.7.4,X code 4.4.1,没有&LT;阵列GT;头文件? [英] Mac OSX 10.7.4, Xcode 4.4.1, no <array> header file?
问题描述
我写会使用C ++标准库的容器阵列举办一些对象的程序。但是,每当我尝试包括code的下面一行在我的计划:
I am writing a program that will use the array container of the C++ Standard Library to hold some objects. However, whenever I try to include the following line of code in my program:
#include <array>
我收到以下错误在编译时:
I receive the following error at compile time:
75-143-76-177:soft jeffersonhudson$ g++ mms.cpp -o mms
mms.cpp:5:17: error: array: No such file or directory
75-143-76-177:soft jeffersonhudson$
注释掉的#include让我编译就好了。当然,我可以俯瞰简单的东西?我已经安装在X code中的命令行工具,我还是我失去了一些东西?
Commenting out the #include lets me compile just fine. Surely I am overlooking something simple? I have installed the "Command Line Tools" in Xcode, am I still missing something?
编辑:
我已经找到阵列的位置,我的电脑上
I have found the location of array on my computer
/usr/clang-ide/lib/c++/v1
知道,我该怎么办?
knowing that, what should I do?
推荐答案
&LT;阵列&gt;的提供了C ++ 11
,您需要提供 -std = C ++ 11
标志来启用它,并为相应的库提供 -stdlib = ++的libc
标记。但经X code提供的G ++太旧而没有为C ++ 11多的支持。你可以切换到铛?
<array>
is provided in C++11, you need to provide the -std=c++11
flag to enable it, and provide the -stdlib=libc++
flag for the corresponding library. But the g++ provided by Xcode is so old which doesn't have much support for C++11. Could you switch to clang?
clang++ -std=c++11 -stdlib=libc++ mms.cpp -o mms
这篇关于MAC OSX 10.7.4,X code 4.4.1,没有&LT;阵列GT;头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!