__thiscall already defined in .obj
Solution 1:
When you define member functions, you have the following choices to prevent multiple definitions:
Put them in the
.cpp
files not in the.hpp
files like you have some of them now. This is the most preferred.Put them inline in the class body. Good for one-liners in some cases.
Put them outside the class body but mark them with the
inline
keyword.
Right now you have member functions defined outside the class body in header files and not marked with inline
. I would recommend you do #1 and move those to the .cpp
files instead.
Solution 2:
You need to move the implementation of the Inventory class methods to a .cpp file.
What's happening is that the header file is included in a few differnt .cpp files, so thise methods are compiled in several differnt compilation units. This causes the that linking error that says those methids already exist in a differnt compilation unit.
In fact all implementations except template implemtations should exist in their own .cpp files, exactly for that reason.