Frequently Asked Questions
What is IncludeBuild?
IncludeBuild is a single-header build framework for C and C++ projects. You describe your build in normal C code using explicit context, project, and target objects.
How do I start?
#define INCLUDEBUILD_IMPLEMENTATION
#include "build.h"
int main(void) {
ib_context* ctx = ib_context_create();
ib_project* project = ib_project_create(ctx, ".");
ib_target* target = ib_project_add_target(project, "app", IB_TARGET_EXECUTABLE);
ib_status status = IB_OK;
if (target) {
status = ib_target_set_entry(target, "main.c");
}
if (status == IB_OK) {
status = ib_project_build(project, IB_MODE_DEBUG);
}
ib_project_destroy(project);
ib_context_destroy(ctx);
return status == IB_OK ? 0 : 1;
}
$ cc -o build build.c
$ ./build
How do I add more sources?
Add sources directly to a target with ib_target_add_source(), or add project-level shared
sources with ib_project_add_shared_source() or ib_project_scan_shared_dir().
How do I add include paths and libraries?
Use ib_project_add_include_dir() or ib_target_add_include_dir() for includes, and
ib_target_add_link_flags() for libraries and linker flags.
ib_project_add_include_dir(project, "include");
ib_target_add_link_flags(target, "-lm");
How do I use a different compiler?
Override the compiler or archiver directly on the project:
ib_project_set_c_compiler(project, "clang");
ib_project_set_cxx_compiler(project, "clang++");
ib_project_set_archiver(project, "llvm-ar");
Does IncludeBuild support incremental builds?
Yes. V2 uses compiler-generated depfiles plus per-object command manifests, so a file rebuilds when its tracked dependencies or effective compile command change.
How do I generate compile_commands.json?
ib_project_write_compile_commands(project, "compile_commands.json");
How do I clean build artifacts?
ib_project_clean(project);
Are there fixed file-count limits?
No. V2 uses dynamic arrays for project state instead of the fixed global limits used by older revisions.
What platforms are supported?
The core design targets GCC/Clang-style toolchains on Linux, macOS, and Windows.
How do I debug a failing build?
Enable verbose output and inspect the diagnostics stored on the context.
ib_context_set_verbose(ctx, true);
ib_context_set_log_level(ctx, IB_DIAG_DEBUG);
fprintf(stderr, "%s\n", ib_context_last_message(ctx));