При компиляции проекта у меня все выскакивает одна и та же ошибка, и я никак не могу разобраться: Code: error LNK2019: unresolved external symbol "public: __thiscall Laptops::Laptops(void)" (??0Laptops@@QAE@XZ) referenced in function "void __cdecl choice_i_fbo(void)" (?choice_i_fbo@@YAXXZ) C:\Users\...\main.obj Исходник: Code: #include <iostream> #include <iomanip> #include <climits> #include <string> #include <vector> #include <cstdlib> using namespace std; void welcome(); void goodbye(); int choice_io(); void choice_i_fbo(); void choice_o_fbo(); class Item { public: Item(); virtual void input(); virtual void output(); static int intvalidation(int lowerbound, int upperbound) { double temp; cin >> temp; while(cin.fail() || temp - int(temp) != 0 || temp < lowerbound || temp > upperbound) { cin.clear(); cin.ignore(INT_MAX, '\n'); cout << "The input must be a whole number between " << lowerbound << " and " << upperbound << ":" << endl; cin >> temp; } cin.clear(); cin.ignore(INT_MAX, '\n'); return int(temp); } static double doublevalidation(double lowerbound, double upperbound) { double temp; cin >> temp; while(cin.fail() || temp < lowerbound || temp > upperbound) { cin.clear(); cin.ignore(INT_MAX, '\n'); cout << fixed << setprecision(2) << "The input must between " << lowerbound << " and " << upperbound << ":"; cin >> temp; } return temp; } protected: double price; int units; string category; string location; }; class Date { public: Date() { day = 1; month = 1; year = 1900; } Date(int x) { day = x; month = 1; year = 1900; } Date(int x, int y) { day = x; month = y; year = 1900; } Date(int x, int y, int z) { day = x; month = y; year = z; } void output() { cout << day << "/" << month << "/" << year; } void input() { double temp; cout << "Please input a day between 1 and 30:"; cin >> temp; while(cin.fail() || temp - int(temp) != 0 || temp < 1 || temp > 30) { if(cin.fail()) { cin.clear(); cin.ignore(INT_MAX, '\n'); } cout << "Please input a day between 1 and 30:"; cin >> temp; } cin.clear(); cin.ignore(INT_MAX, '\n'); day = int(temp); cout << "Please input a month between 1 and 12:"; cin >> temp; while(cin.fail() || temp - int(temp) != 0 || temp < 1 || temp > 12) { if(cin.fail()) { cin.clear(); cin.ignore(INT_MAX,'\n'); } cout << "Please input a month between 1 and 12:"; cin >> temp; } cin.clear(); cin.ignore(INT_MAX, '\n'); month = int(temp); cout << "Please input a year between 1900 and 2100:"; cin >> temp; while(cin.fail() || temp - int(temp) != 0 || temp < 1900 || temp > 2100) { if(cin.fail()) { cin.clear(); cin.ignore(INT_MAX,'\n'); } cout << "Please input a year between 1900 and 2100:"; cin >> temp; } cin.clear(); cin.ignore(INT_MAX,'\n'); year=int(temp); } private: int day; int month; int year; }; class Computers : public Item { public: Computers(); string getname() { return name; } void input() { cout << "Type:"; getline(cin, name); cout << "Price:"; price = doublevalidation(0, 10E9); cout << "Units in stock:"; units = intvalidation(0, INT_MAX); cout << "Guarantee Expiration date:\n"; Guarantee_expiration.input(); cout << "Location:"; getline(cin, location); cout<<"Input the Operating System:\n"; getline(cin, OS); } void output() { cout << fixed << endl; cout << "Type:" << name << setw(10) << "Price:" << setprecision(2) << price << "$" << setw(20) << "Item location:" << location << endl; cout << "Guarantee Expiration date:"; Guarantee_expiration.output(); cout << setw(20) << "Units in stock:" << units; cout<< "Operating System:"; getline(cin, OS); } protected: string name; Date Guarantee_expiration; string OS; }; class Desktops : public Computers { public: Desktops(); void input() { Computers::input(); cout << "Enter the size of the Graphich Card:"; cin >> Graphichcard; cout << "Enter the size of the RAM:"; cin >> RAM; cout << "Number of Computers put in the storage:"; quantity = intvalidation(0, 10e9); } void output() { Computers::output(); cout << "Graphich Card size:" << Graphichcard << setw(25) << "RAM size:" << RAM << endl << endl; cout << "Number of Computers stored:" << quantity << endl; } private: double quantity; int Graphichcard; int RAM; }; class Laptops : public Computers { public: Laptops(); void input() { Computers::input(); cout << "Please enter the screen size in cm:"; Screen_size = doublevalidation(0,10e9); cout << "Please enter the endurance of battery in hours:"; Battery_life = doublevalidation(0,10e9); cout << "Please enter the weight of the laptop:"; weight = doublevalidation(0,10e9); cout << "Please enter the number of Laptops:"; nr_laptops = intvalidation(0,10e9); } void output() { Computers::output(); cout<<"Screen size:"<< Screen_size <<endl; cout<<"Battery Endurance<<"<< Battery_life <<endl; cout<<"Weight of the laptop"<< weight <<endl; cout<<"Number of laptops stored:"<< nr_laptops <<endl; } private: int Screen_size; int Battery_life; double weight; double nr_laptops; }; class Gadgets : public Item { public: Gadgets(); void input() { cout << "Type:"; getline(cin, title); cout << "Price:"; price = doublevalidation(0,10e9); cout << "Discount as a percentage:"; discount = doublevalidation(0,100); cout << "Units in stock:"; units = intvalidation(0,INT_MAX); cout << "Location:"; getline(cin, location); cout << "Category:"; getline(cin, category); } void output() { cout << fixed << endl; cout << "Type:" << title << setw(10) << setw(15) << "Category:" << category << setw(20) << "Item location:" << location << endl; cout << "Price without discount:" << setprecision(2) << price << "$" << setw(25) << "Price with discount:" << price*(100-discount)/100 << "$" << endl; cout << "Units in stock:" << units << endl << endl; } private: string title; double discount; string category; }; ... Code: void choice_i_fbo() { int inputmenu; Item *a; cout << "Press 1 to input desktops data\n" "Press 2 to input laptops data\n" "Press 3 to input devices data\n" "Press 0 to return to the main menu\n" "Your option:"; inputmenu = Item::intvalidation(0,3); switch(inputmenu) { case 0: break; case 1: a=new Desktops; v_desktops.push_back(a); v_desktops[v_desktops.size()-1]->input(); break; case 2: a=new Laptops; v_laptops.push_back(a); v_laptops[v_laptops.size()-1]->input(); break; case 3: a=new Gadgets; v_devices.push_back(a); v_devices[v_devices.size()-1]->input(); break; } } Хееееееееелп! =)
У тебя конструктор класса Laptops объявлен, но не определен. В программе не разбирался, либо убери объявление, либо доопредели его код.