0
我想在mac上用clang ++编译C++ 11列表集合初始化。铿锵集支持Mac OS X上的聚合初始化
#include <iostream>
#include <list>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
list<string> aList = {"abc", "def", "xyz"};
}
这是编译的命令。
clang++-mp-3.1 -std=c++11 iterator.cpp
我没有找到匹配的构造函数错误。
iterator.cpp:7:23: error: no matching constructor for initialization of
'std::list<string>'
std::list<string> aList = {"abc", "def", "xyz"};
^ ~~~~~~~~~~~~~~~~~~~~~
我的XCode
clang -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
试过我也是从端口
clang++-mp-3.1 -v
clang version 3.1 (branches/release_31)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
我得到了相同的结果试图用铿锵++。什么可能是错的?
clang's support of C++ 11 lambda
'-std = C++ 11' ...... – 2013-06-01 22:02:18
你有使用' - std = C++ 11'或'-std = C++ 0x'标志? –
@ H2CO3:我有这个标志。 – prosseek