Versions used
- SonarQube Server: Enterprise Edition v2025.1
- SonarScanner CLI: 7.3
- C++ / CFamily Analyzer: bundled with SonarQube Enterprise
- Deployment method: Docker
Problem description
During analysis, the C++ analyzer reports warnings like:
WARN:
The analyzer was not able to find file
<generated_header_directory>/GeneratedHeader.h
included from file <source_directory>/SomeHeader.h
However:
- The generated header exists on disk before running
sonar-scanner. - The file path is correctly present in
compile_commands.json. - The project compiles successfully with no missing includes.
- Multiple generated headers trigger similar warnings.
Commands used
build-wrapper-linux-x86-64 --out-dir .sq \
cmake --build <build-directory> --target <target-name>
sonar-scanner \
-Dsonar.pullrequest.key=$MR_IID \
-Dsonar.pullrequest.branch=$SOURCE_BRANCH \
-Dsonar.pullrequest.base=$DEST_BRANCH \
-Dproject.settings=./sonar-project.properties
What I have tried so far
- Confirmed that the generated files exist before the scanner runs.
- Verified the paths appear correctly in
compile_commands.json. - Checked that the include paths used during compilation are correct.
- Rebuilt the project with/without parallel build flags.
- Verified the build-wrapper output directory contains all compilation commands.