Create an accurate C/C++ project (Strict vs Fuzzy)¶
Why this matters¶
The more Understand knows about your include paths and macro configuration, the more closely its analysis matches your compiled code. Accuracy problems show up as:
- Chunks of inactive code, shaded in the editor, that should be parsed but aren't (a macro isn't
defined, so the wrong
#ifdefbranch is active). - The same entity appearing multiple times, some references unresolved (drawn in the theme's disabled/"unknown entity" color).
- Missing entities in graphs and references.
Choose a parsing mode: Strict vs Fuzzy¶
Understand has two C/C++ parsing modes, controlled by the UseStrict setting
(Project Configuration → C++, or und settings -C++UseStrict On|Off).
Uses the Clang front end. Most closely matches what your compiler actually sees — best for precise cross-references, metrics, and CodeCheck. It relies on an accurate include/macro configuration, so feed it your real build (below).
The older, tolerant parser. It doesn't require a complete include/macro setup, so it's resilient
to missing headers — useful for a quick first look when you can't provide build information.
Fuzzy predates modern C++: its language model is C++03-era. It won't fail outright on newer
code (unrecognized keywords are skipped over), but C++11-and-later constructs — auto type
deduction, lambdas, constexpr, and everything since — are not modeled, so cross-references in
modern code will be incomplete. Use Strict for any C++11-or-later codebase.
Tip
Strict is on by default and is what you want for accurate analysis. Only switch to Fuzzy if you can't supply an accurate build configuration.
Feed Understand your real build (most accurate)¶
The most reliable way to get accurate includes and macros is to derive them from how your code is actually compiled:
- CMake /
compile_commands.json— in the New Project wizard use the CMake Compilation page (“Specify CMake Compilation Database?”), or from the CLI:und add-cmake compile_commands.json. - Visual Studio / Xcode — the wizard's Import Settings page, or
und add -vs …/und add -xcode …. - Build Watcher / Buildspy — watch a clean build to capture exact per-file flags (see Build Watcher vs Buildspy).
Fix specific accuracy problems¶
Use Project → Improve Project Accuracy:
- Missing Includes — opens the missing-header configuration so you can add include directories.
- Undefined Macros — define macros so the intended
#ifdefbranch becomes active (clears the inactive-code shading). - More Information — opens SciTools' accurate-projects guidance.
After adjusting includes/macros, re-analyze (Project → Analyze All Files, or
und analyze) — fix parse errors walks through the
symptoms and fixes in more detail.
Relevant C/C++ setting keys (each has Add/Remove variants): -C++Includes, -C++SystemIncludes,
-C++Macros, -C++Undefined, -C++Frameworks, -C++Auto — the full list is in the
und settings reference.
Beyond plain C/C++¶
Other languages have their own configuration knobs — see the per-language accuracy notes — and one project can mix several languages in a single database. Cross-compiled firmware and machine-generated C/C++ each have a dedicated guide: embedded / firmware projects and generated code.