Say I have two files a.cpp and b.cpp and they both use a function in c.hpp. If I #include "c.hpp" in both a.cpp and b.cpp I would get an error during linking saying the symbol has been defined twice (since header guards don't prevent inclusion across multiple translation units)
So how do I give both .cpp files access to the function in c.hpp without getting an error during linking?
c.hpp? Just the prototype, or also the implementation? By your edit I am assuming the full implementation. - indivc.pp. - Jerry Coffininline, or defined inside a class definition) have slightly different rules, that allow multiple definitions as long as they're all identical. - Jerry Coffin