99%的原因就是没有包含头文件,编译器不认识所定义的类型。 例如:vector<int> vec;,如果出现如标题错误,肯定是没有加下面的代码 #include <vector> using namespace std;