Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 8.0.1
-
None
-
Debian 11, Yocto cross compile SDK
-
049c2cf6f3 (qt-creator/qt-creator/master) 049c2cf6f3 (qt-creator/qt-creator/9.0)
Description
Since QtCreator is using clangd for the code model we always had a huge count of false errors in our project when having our ARM target Kit selected. Today I found out that this was caused by QtCreator not passing the parameters of the specified mkspec file to the generated compile_commands.json file.
This causes QtCreator to include different files than the clangd code model expects, which causes a lot of false error messages. See attached errors.png. It also generates a lot of "cannot initialize object parameter of type ... with expression of type ..." errors like seen in https://bugreports.qt.io/browse/QTCREATORBUG-28016. But those I could not reproduce in the sample project and I can't share the code of our real project.
When adding the parameters in the .pro file through "QMAKE_CXXFLAGS +=", they are added to the compile_commands.json file (see arguments.png) and the code model works perfectly fine.
In our case the problem was, that our target is hard-floating, but since the parameter "-mfloat-abi=hard", which is defined in our mkspec linux-oe-g++ was not passed into the compile_commands.json it did not work correctly.
I think QtCreator should pass all CXXFlags which are effective for compile also to the clangd compile_commands.json file.
Attachments
Issue Links
- relates to
-
QTCREATORBUG-27372 Code editor shows semantic, lexical or preprocessor issues when opening a qmake application
- Closed