1、无法解析的外部命令,然后会跟着一个对象的构造函数的提示信息,例如:
错误 1 error LNK2019: 无法解析的外部符号 "public: __thiscall Account::Account(void)" (??0Account@@QAE@XZ),该符号在函数 "public: class Account * __thiscall Account::init_heap_array(class std::vector<struct std::pair<char *,int>,class std::allocator<struct std::pair<char *,int> > > &,unsigned int)" (?init_heap_array@Account@@QAEPAV1@AAV?$vector@U?$pair@PADH@std@@V?$allocator@U?$pair@PADH@std@@@2@@std@@I@Z) 中被引用 main.obj
这表明缺乏缺省构造函数,会导致对象不能初始化,无法为其分配内存,只需将缺省构造函数补上即可。
2、使用vector过程中会如果想采用如下初始化vector会引发与"xutility"头文件相关的错误:
vector<info_type> info_type_vec(init_values[0],init_values[1]);
这种错误是由于vector不能这样初始化,应当采用插入(push_back)的方式插入元素:
vector<info_type> info_type_vec(2);
info_type_vec.push_back(init_values[0]);
info_type_vec.push_back(init_values[1]);