I am developing a project using MinGW and qmake with Qt Creator IDE. For some time I have been receiving strange and completely baseless clangd warnings in the QT Creator editor, but the code still compiles correctly. I created a new project to check if I would receive similar warnings and the newly created project works properly without errors. What could I have done wrong in my project that I am getting these errors and how can I fix it? Below are some warnings and a fragment of the .pro file.
.pro file fragment:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++20
CONFIG += qwt
CONFIG += staticlib
CONFIG += static-libgcc
CONFIG += static-libstdc++
CONFIG += disable-desktop
CONFIG += qtquickcompiler
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++20
CONFIG += qwt
CONFIG += staticlib
CONFIG += static-libgcc
CONFIG += static-libstdc++
CONFIG += disable-desktop
CONFIG += qtquickcompiler
To copy to clipboard, switch view to plain text mode
Some Qt components include are getting errors, e.g. this:
#include <QWidget>
#include <QWidget>
To copy to clipboard, switch view to plain text mode
is generating this error:
In included file: unexpected type name 'size_t': expected expression
In included file: unexpected type name 'size_t': expected expression
To copy to clipboard, switch view to plain text mode
Also the range based C++11 for loops are generating errors:
for (auto button : buttonGroup_alphabetic.buttons()) {
button->setText(button->text().toUpper());
}
for (auto button : buttonGroup_alphabetic.buttons()) {
button->setText(button->text().toUpper());
}
To copy to clipboard, switch view to plain text mode
error:
Expected '(' for function-style cast or type construction
Expected '(' for function-style cast or type construction
To copy to clipboard, switch view to plain text mode
Bookmarks