If I define a function (maybe a class member function but not inlined) in a header file that is included by two different translation units I get a link error since that fun
It actually does create multiple copies. Those copies are special and don't violate the one-definition rule. Some linkers will come along, remove the copies, and relink the functions using them; not all do.