https://github.com/nothings/stb
Important difference to typical C++ header-only libs: STB style libs don't use the inline keyword, but instead place the implementation into an ifdef/endif block.
It's really just for easier distribution and integration, and the difference to a single .h/.c pair isn't all that big.
Definitely not big enough to get all riled up about it - the actual problem are libraries that come in dozens of source and header files and with their own build system files, or C++ libraries which put the implementation into inline code, like most C++ stdlib headers (because this increases compilation time for every file which includes such a header).
I do also like easily embeddable tech like imgui, or lua, where you can simply copy the source code in your source tree.
How come we have managed during the last 40 years?
Yeah we managed, I never said the opposite. I only talked about why I liked header-only libs: because I just copy/paste the source in my source tree, regardless of the build system I use.
If I'm using CMake, and a library is using autotools, I'll have to rewrite the lib's build system, and maintain it. I'm too lazy for that.
Nowadays, use cmake + conan/vcpkg as alternative as well.
Do we need to spoon-feed everything?
Also it is a toy library in size, then there are those that can be used to stress test compilers.
If I have a template header .hpp and I do not wish to specialize the template function bodies in a .cpp file, the template header function bodies must be declared in the .hpp, right?
Yes it needs to be on the header, however depending on what is the goal, many operations could eventually be delegated to helper functions or PIMPL classes, which aren't fully exposed on the header.
And for the lucky users of VC++ 2022, there is also the option to use modules instead, where templates are then exposed via the module metada.
Thanks for your comment.
I will have to dig in to modules in due course.