我正在尝试使用此命令行
在使用clang ++的Windows中编译一些代码clang++ -std=c++11 *.cpp -Wall
但我得到以下内容:
Datetime.cpp:74:9: error: no member named 'stoi' in namespace 'std'
std::stoi(match.str(1)),
~~~~~^
Datetime.cpp:75:9: error: no member named 'stoi' in namespace 'std'
std::stoi(match.str(2)),
~~~~~^
Datetime.cpp:76:9: error: no member named 'stoi' in namespace 'std'
std::stoi(match.str(3)),
~~~~~^
Datetime.cpp:77:9: error: no member named 'stoi' in namespace 'std'
std::stoi(match.str(4)),
~~~~~^
Datetime.cpp:78:9: error: no member named 'stoi' in namespace 'std'
std::stoi(match.str(5)),
~~~~~^
Datetime.cpp:79:9: error: no member named 'stoi' in namespace 'std'
std::stoi(match.str(6))
~~~~~^
6 errors generated.
fileReader.cpp:21:47: error: no member named 'stod' in namespace 'std'
scoe.semiMajorAxis = std::stod(line, nullptr);
~~~~~^
fileReader.cpp:24:53: error: no member named 'stod' in namespace 'std'
scoe.orbitalEccentricity = std::stod(line, nullptr);
~~~~~^
fileReader.cpp:27:58: error: no member named 'stod' in namespace 'std'
scoe.orbitalInclination = dtr * std::stod(line, nullptr);
~~~~~^
fileReader.cpp:30:57: error: no member named 'stod' in namespace 'std'
scoe.argumentOfPerigee = dtr * std::stod(line,nullptr);
~~~~~^
fileReader.cpp:33:63: error: no member named 'stod' in namespace 'std'
scoe.rightAscOfAscendingNode = dtr * std::stod(line...
~~~~~^
fileReader.cpp:36:51: error: no member named 'stod' in namespace 'std'
scoe.trueAnomaly = dtr * std::stod(line, nullptr);
~~~~~^
fileReader.cpp:70:41: error: no member named 'stod' in namespace 'std'
atmosDensity.push_back(std::stod(line, nullptr));
~~~~~^
7 errors generated.
(我已包含在这些文件中)
代码在Visual Studio 2013中编译并正常工作。如何使用clang ++?
答案 0 :(得分:0)
您必须添加<string>
标头并使用-std=c++11
或-std=c++14
或其他任何内容进行编译,并记住选择带有-stdlib=libc++
的正确标准库。