当我在Visual Studio社区2017中编译下面的代码时,有很多错误。你能说出如何解决这个问题吗?
#include <stdexcept>
#include <iostream>
class TrainComposition
{
std::vector<int> wagons;
public:
void attachWagonFromLeft(int wagonId)
{
wagons.insert(wagons.begin(), wagonId);
std::cout << "attach wagon from left, id is:" << wagonId << '\n';
}
....
1&gt; c:\ users \ wanglei \ documents \ visual studio 2017 \ projects \ consoleapplication1 \ consoleapplication1 \ consoleapplication1.cpp(6):错误C2039:&#39; vector&#39;:不是&#的成员39; STD&#39;
的声明
1&gt; c:\ program files \ microsoft visual studio \ 2017 \ community \ vc \ tools \ msvc \ 14.10.25017 \ include \ iostream(13):注意:参见&#39; std&#39;
答案 0 :(得分:1)
您应该将文件顶部的矢量库包含在其余的include语句中。
function functionPrev() {
alert("Alert!");
return false;
}