How do I create a header-only library?
I'd like to package a library I'm working on as a header-only library to make it easier for clients to use. (It's small and there's really no reason to put it into a separate translation unit) However, I cannot simply put my code in headers because this violates C++'s one definition rule. (Assuming that the library header is included in multiple translation units of a client project) How does one modify a library to make it header-only? You can use the inline keyword: // header.hpp (included into multiple translation units) void foo_bad() {} // multiple definitions, one in every translation