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?
For a long function you would want to give the function it's own translation unit, moving the implementation to it's own CPP and only keeping the declaration in the header.
If the function is short you can add the inline keyword:
This allows the compiler to inline the function in each translation unit, avoiding the multiple definintions.