所以我刚添加了第二个构造函数,并在尝试构建时收到错误LNK2019。我想念什么?
car.h
Car(const Engine& eng1, const string& name, const int& year, const string & col);
Car();
car.cpp
Car::Car(const Engine& eng1, const string& name, const int& year, const string & col) {
setEngine(eng1);
setYear(year);
setManufacturer(name);
setColor(col);
}
Car::Car() {
setYear(0);
setManufacturer("~");
setColor("~");
}
主要故障
Car car1;
完全错误:
错误LNK2019无法解析的外部符号“ public:__thiscall Garage :: Garage(class std :: basic_string,class std :: allocator> const&,int const&)”(?? 0Garage @@ QAE @ ABV?$ basic_string @在函数_main HW1 C:\ Users \ User \ Desktop \ Computer Science \ oop \ HW \ 1 \中引用的DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ ABH @ Z) HW1 \ HW1.obj 1