Priority: Not Evaluated
Affects Version/s: Qt Creator 6.0.0-beta1
Fix Version/s: None
Component/s: C/C++/Obj-C++ Support
Environment:Operating System: Arch Linux
The errors occur for C++ stdlib headers as well as Qt 5 and 6 headers.
I'm using GCC/Clang kits, both stock and modified to use LLD.
I have some CMake projects where I only include .cpp translation units, but not .h headers, in CMakeLists.txt (so I have to edit CMakeLists.txt less often).
I installed Qt Creator 6.0.0-beta1 and decided to test the new clangd mode. However, I ran into many false-positive errors in my header files:
- The first #include in the file has an error "'path' file not found". If you remove it, the error moves to the second #include. This applies to both project includes ("file.h"), Qt headers (<QString>), and C++ stdlib headers (<type_traits>).
- None of the includes (not even those with no visible errors) were successfully processed. As a result, the rest of the header is filled with errors (unrecognized std::, unrecognized QString and QObject, the Q_OBJECT and signals macros aren't defined).
These errors do not appear in the previous Clang Code Model, nor when building the project in CMake Ninja GCC/Clang.
Additionally, when starting Qt Creator and opening any header not found in CMakeLists.txt, I get a "This file is not part of any project" message. Running "Rescan Project" makes the message disappear, but the false errors remain. If I include a header in CMakeLists.txt and "Rescan Project", then the errors go away for that header.
If I again remove the header from CMakeLists.txt and "Run CMake" or "Rescan Project", the errors remain absent until I restart Qt Creator.
To make the errors reappear, I must:
- Remove the header from CMakeLists.txt.
- "Run CMake" or "Rescan Project" (making the "This file is not part of any project" message reappear, but not the errors).
- Restart Qt Creator (both the message and the errors appear).
Is Qt Creator intended to support "not listing headers in CMakeLists.txt, and having the code model infer each header's include paths from which .cpp files include it"?
Additionally, in both .cpp and .h files, when I type #include <Q, I don't get uppercase includes like <QObject>, but only lowercase ones like <qobject.h>.