0

Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?

i am trying to make a list of pointers to child classes and try to find/delete objects with them with an other class

//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);
    }
}

errors

1>book.obj : error LNK2001: unresolved external symbol "public: static class std::vector<class Product *,class std::allocator<class Product *> > Product::plist"

1>cd.obj : error LNK2001: unresolved external symbol "public: static class std::vector<class Product *,class std::allocator<class Product *> > Product::plist"

1>ProductCatalog.obj : error LNK2001: unresolved external symbol "public: static class std::vector<class Product *,class std::allocator<class Product *> > Product::plist"

1>ProductCatalog.obj : error LNK2019: unresolved external symbol "public: __thiscall Product::Product(void)" (??0Product@@QAE@XZ) referenced in function "public: __thiscall ProductCatalog::ProductCatalog(void)"

1>ProductCatalog.obj : error LNK2001: unresolved external symbol "public: static class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class Product *> > > Product::tT"

Community
  • 1
  • 1
meh
  • 25
  • 1
  • 5
  • 1
    http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix/12574407#12574407 section "static data members must be defined outside the class in a single translation unit" – Luchian Grigore Nov 27 '12 at 22:05
  • try to use vector> also, or vector> - depending on the usage... – joy Nov 27 '12 at 22:08
  • how am i gonna initialize vector or iterator i cant fix it – meh Nov 27 '12 at 22:35

0 Answers0