0

重複の可能性:
未定義の参照/未解決の外部シンボル エラーとは何ですか? また、どのように修正すればよいですか?

子クラスへのポインターのリストを作成し、他のクラスでオブジェクトを検索/削除しようとしています

//class product
public:
    static vector<Product*> plist;
    static vector<Product*>::iterator tT;


//class book:public Product 
book::book(string a,double b, string c,string d,string e):Product(a,b,c),
    author(d),publisher(e)
{
    Product *k=this;
    plist.push_back(k);
}



class ProductCatalog:public Product // i really dont know how to implement this friend maybe
{
public:
    ProductCatalog();
    void findproduct(string);
    void deleteproduct();
    void addproduct();
    void listcatalog();

};

void ProductCatalog::findproduct(string temp){

    cin>>temp;
    tT=plist.begin();
    for (tT=plist.begin();tT!=plist.end();tT++){
        if((*tT)->getID()==temp)
            (*tT)->getSummery();
    }
}

void ProductCatalog::deleteproduct(){
    cout<<"enter id to delete"<<endl;
    string dd;
    cin>>dd;
    tT=plist.begin();
    for (tT=plist.begin();tT!=plist.end();tT++){
        if((*tT)->getID()==dd)
            plist.erase(tT);
    }
}

エラー

1>book.obj: エラー LNK2001: 未解決の外部シンボル " public: static class std::vector<class Product *,class std::allocator<class Product *> > Product::plist"

1>cd.obj: エラー LNK2001: 未解決の外部シンボル " public: static class std::vector<class Product *,class std::allocator<class Product *> > Product::plist"

1>ProductCatalog.obj: エラー LNK2001: 未解決の外部シンボル " public: static class std::vector<class Product *,class std::allocator<class Product *> > Product::plist"

1>ProductCatalog.obj : エラー LNK2019: 未解決の外部シンボル " public: __thiscall Product::Product(void)" (??0Product@@QAE@XZ) が関数 " public: __thiscall ProductCatalog::ProductCatalog(void)"で参照されています

1>ProductCatalog.obj: エラー LNK2001: 未解決の外部シンボル " public: static class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class Product *> > > Product::tT"

4

0 に答える 0