Capture your build — Build Watcher vs Buildspy¶
Both tools watch your compiler during a build and record the exact files, include paths, and
macros it uses — giving Understand a project that matches what you actually compile (ideal for the
Strict/Clang parser). Use one when you can't easily produce a compile_commands.json.
Using CMake?
Prefer importing compile_commands.json (CLI:
und add-cmake) — it captures the same information cleanly and stays
in sync automatically.
Which one?¶
| Build Watcher | Buildspy | |
|---|---|---|
| Interface | GUI (New Project wizard) | Command line |
| Best for | Interactive setup | Headless / CI / scripted builds |
| How it watches | Monitors named compiler processes while you build | Wraps the compiler (gccwrapper/g++wrapper) or runs your build for you |
Build Watcher (GUI)¶
In the New Project wizard, the BUILD PROJECT page (“Watch Your Project Build”) monitors your regular build to capture include paths and macros:
- Do a clean build first (
make clean/ninja clean) and plan to build one target per project. - On the watch page, start your build in a separate terminal — Understand watches for the compiler binaries listed under Build Watcher Options → Compiler Names and populates the project live as files compile.
Buildspy (CLI)¶
buildspy ships in …/scitools/bin/<platform>/buildspy (add it to your PATH). Two ways to use it:
# A) Let buildspy run your build:
buildspy -db project.und -cmd "make <target>"
# B) Or replace your compiler with the wrappers in your build system:
# gcc -> gccwrapper g++ -> g++wrapper
- Works with any gcc-like compiler. For a non-default compiler, pass
-cc/-cxx(or setUND_PBCCCOMPILER/UND_PBCXXCOMPILER) so the wrappers call the right binary — pointing them at a cross-compiler is covered in embedded / firmware projects. - Start from a clean build so every file is seen.
Running Buildspy inside a pipeline (capture on the build agent, then analyze) is covered in Buildspy in CI.
After capturing¶
Open the project and Analyze All — the captured includes and macros are now set. If some remain unresolved, use fix parse errors.