HACKER Q&A
📣 QuadrupleA

C programmers, how do you manage header files?


One of the hassles of C/C++ programming is maintaining header files; including the right ones to resolve missing symbols, keeping declarations and definitions in sync, preventing circular dependencies with pragmas or include guards, etc.

In the past on large codebases I've used IDE plugins - Visual Assist X [1] lets you change function signatures, create declarations from definitions and vise versa, and add the include for a missing symbol. I'm no longer using Visual Studio proper though for C stuff so that's no longer available to me.

I recently stumbled on makeheaders [2] by sqlite's creator, used for the fossil version control codebase - it let's you write just the C files, and generates corresponding header files during build, with help from some macro keywords. Seems like a promising approach.

Curious what other solutions people have used to eliminate the unnecessary busywork of header files?

[1] https://www.wholetomato.com

[2] https://www.hwaci.com/sw/mkhdr/