
Lessons learned about how to make a header-file library (2013) - Tomte
https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
======
n00b101
Please don't make header file libraries. It will be messy and a nightmare to
modify. Header files are for declarations and implementation should be in a
separate file.

~~~
flohofwoe
I don't agree, header file libraries are great and the apparent advantage to
header/source pair are negligible in practice (I use the STB headers all the
time in different projects). One advantage is that you can simply add all the
configuration defines (e.g. what assert macro and allocation functions to use,
all the configuration options, ...) simply in front of the include statement
and you don't need to mess around with the build system or compiler command
line options to define those.

Of course you usually wrap the header-only-lib in a central header/source pair
of your own, so that those configuration defines and the implementation are in
a single place instead of directly including the library header in different
places.

~~~
marssaxman
What's the advantage of packing everything into a header file if every single
user of this "library" has to unpack it back out again? Why not just ship a
header+source file, like civilized people have been doing since the dawn of C?

