[Qt-creator] Compilation Database not picked up by Qt Creator (14.0.1, Windows 11)
Hugo Melder
hugo at algoriddim.com
Thu Oct 17 13:27:41 CEST 2024
Hi,
I cannot get QTC to pick up the compile_commands.json file generated by CMake.
Here some things I’ve tried out:
1. Create a .clangd configuration file to hard-code the compilation database location
2. Move compile_commands.json into the top-level of the project
3. Verify that clangd is configured with the correct workspace folder (Language Client Inspector)
OS Info:
WindowsBuildLabEx : 22621.1.arm64fre.ni_release.220506-1250
OsName : Microsoft Windows 11 Pro
OsVersion : 10.0.22631
CsSystemType : ARM64-based PC
QtCreatorVersion : 14.0.1 (Enterprise)
Steps to reproduce:
1. Create a new Qt Quick Application.
2. Click on "Projects" on Sidebar
3. Add "CMAKE_EXPORT_COMPILE_COMMANDS" to initial configuration
4. Reconfigure the project
The build directory now contains a compile_commands.json file.
We can now edit compile_commands.json to test, if it is really picked up. Find the entry for main.cpp and add '-DFOOBAR' to the command.
QTC greys out an "#ifdef FOOBAR" block, despite FOOBAR being defined in the build command for main.cpp.
Does QTC support compilation databases?
~ Hugo
More information about the Qt-creator
mailing list