End-users often like single header C/C++ libraries because they require very little work to integrate into their projects. However, a single file can be difficult to read and maintain. This is a web-based tool to get the best of both worlds.
Nuklear is an awesome C library whose source code is currently over 25,000 lines—all contained in a single header file. I forked the library and split it into multiple files.
<--Click this to generate single header file from multi-file GitHub repo
The URL-builder below takes the following inputs:
/* [intro file contents] */ #ifndef [macro prefix]_SINGLE_HEADER #define [macro prefix]_SINGLE_HEADER [public header file contents] #endif /* [macro prefix]_SINGLE_HEADER */ #ifdef [macro prefix]_IMPLEMENTATION [private header and source file contents] #endif /* [macro prefix]_IMPLEMENTATION */ /* [outro file contents] */
#includestatements are omitted for files already included in public and private headers. e.g. if headers contain a file called
my_lib.h, then all instances of
#include <my_lib.h>will be omitted from source files and private headers.
This web page is largely self-contained, only relying on an external style-sheet. I am making the contents of this web page and the code behind it public domain. You are encouraged to host a copy of this page on your own website, and modify it as you see fit.
Intro comment files (optional):
Source files and private headers:
Outro comment files (optional):