enter code here
i am using dev c++ for my programming. as i am using some library developed on dev c++ i want to use the same compiler.
for my own dev project, i wanted some new classes. so i have added 2 classes "TriangleLists, TriangleList" (h file and cpp files) to the library. when i compiled the library it worked without any error and able to create new library file. but, when i am compiling my own project i got the linker error problem.
[Linker error] undefined reference to `TriangleLists::Erase()'
[Linker error] undefined reference to `TriangleList::TriangleList(TriangleList const&)'
[Linker error] undefined reference to `TriangleList::operator=(TriangleList const&)'
ld returned 1 exit status
actually, in the library there were similar classes called RectangleList, RectangleLists.. so, i copied those 2 classes and modify to fit with my class TriangleList.
any suggestion to solve this please. thanks in advance,
Is class
TriangleListsmade by you or does it belong to the library?Often a class object is not intended to be copied, and just cannot be done. To prevent library users to copy uncopyable objects creator may declare copy constructor and assignment operator (usually as private), but omit the the definition. If this is the case then just don’t copy objects, and don’t use them in a way that involves copying (like putting them in some
stdcontainer). You may create objects on the heap and put pointers to those objects to a container.EDIT: If those are your classes then answer is simple. Add function
Eraseto classTriangleListsand add copy constructor and assignment operator to classTriangleList. Since you’re copying functionality from similar classRectangleListsearch for its copy constructor and assignment operator,RectangleList::RectangleList(RectangleList const&)andRectangleList::operator=(RectangleList const&).