Strange behavior with Qt Creator 4.8.1 editor and coding syntax
-
I don't think I had this behavior prior to version 4.8.1.
The Qt Creator editor is (well, used to be) pretty smart about catching syntax errors prior to compilation. However, it appears to no longer as smart as it once was. For example, in prior versions, it was aware of new typedefs and defines from header files. Now, almost every variable is accompanied by a warning about "use of undeclared identifier" for user-defined types.
For a typical .cpp file, I now have anywhere from 50 to 1000 "Issues" to sift through looking for some small number of real coding problems.
Has anyone else seen this and have suggestion for what I may have configured incorrectly?
Everything compiles and debugs fine, but this is a constant annoyance.
Thanks
-
Hi,
Do you still have the same behaviour if you disable the Clang code model plugin ?
-
@SGaist Thanks. Not sure what you mean exactly. Under Options/C++/CodeModel, I see that "the Clang Model is enabled because the corresponding plugin is loaded". I can set the Diagnostic Configuration (several options for Clang, Clang-Tidy, and Clazy), but not sure which of the several would be most appropriate. Tried several and didn't see the symptom go away. Didn't see a way to disable it all.
-
It's explained in the Parsing C++ Files with the Clang Code Model chapter of Qt Creator's documentation.
From that page:
To use the built-in code model instead, select Help > About Plugins > C++, and deselect the ClangCodeModel check box. The changes take effect after you restart Qt Creator.
-
@drmhkelley said in Strange behavior with Qt Creator 4.8.1 editor and coding syntax:
But that then raises other questions. What is Clang and why would I want it if it just adds grief? Must be good for something, but can't see what.
It obviously failed for you, and that is surely not the wanted behavior. Clang is a real compiler that gives more information about your code and supports newer C++ standards than the internal code model could.
On the other hand, it is very fragile to syntax errors, missing includes etc.
Have a look here for more information: https://blog.qt.io/blog/2018/06/05/qt-creators-clang-code-model/
Regards