解决方法: 方法1,加上 using namespace std; 方法2, std::vector v; 熟练使用C++的人一般不用using namespace std,而在使用cout时候,用全名std::cout。这样做的原因是为了防止不同命名空间函数的重复。