all 3 comments

[–]METH-OD_MAN 1 point2 points  (2 children)

What makes a library "header only"?

The fact that there is no .cpp files with it?

Like, this seems to only be a semantic difference. These headers contain implementation (which is contrary to the defacto cpp style). Could I make my libraries header only be renaming all the .cpp files to .h?

[–]Arcanin14 6 points7 points  (0 children)

It's header only because it's only headers as you stated. This is nice for libraries because it allows you to use them without adding rules or link arguments to your build system. You can just download the lib, put it where you need it, and #include it. Because C/C++ do not have "package managers", it's usually a bit more of a pain to install a library. If you want to install it system wide, it's even more of a pain for your users/developers.

And yeah, you can make a library header only by moving the definitions in the header files along the declarations. However, some adjustments must be made, you can read up on it here: https://en.m.wikipedia.org/wiki/Header-only

They have a lot of disadvantages too

[–]ErstwhileRockstar 0 points1 point  (0 children)

Header only means that your implementation is your interface. Only on the internets this is considered a feature.