Good morning, I’m stupid, I can’t understand what’s wrong, that is, I know which line, but what exactly and how to fix is not clear, here’s a very simplified version of what I need.
class Tree{ public: void add_element(Tree); vector<Tree> get_vector(); }; class Directory: public Tree{ private: string name; vector<Tree> element; public: Directory(string name){ this->name = name; } void add_element(Tree tree){ element.push_back(tree); } }; int main(){ Tree *root = new Directory("root"); Tree *d1 = new Directory("klk"); root->add_element(*d1);// тут он дает ошибку, добавлю в конце кода } //error LNK2019: unresolved external symbol "public: void __thiscall Tree::add_element(class Tree)" (?add_element@Tree@@QAEXV1@ @Z ) referenced in function _main
Tried to wrap in shared_ptr, ..., tell me where I’m dumb, thanks. Maybe I'm doing something wrong with the initialization of the vector? ..., thank you for your attention.