Lot of errors but it builds and runs successfully
-
I cross-compiled Qt5.13 for ARM A7 and then I downloaded QtCreator 4.10.0 for Linux (Ubuntu).
Trying to build a code I've used for years now I get a new behavior of the IDE. The code is compiled without any error and works as expected but the editor is full of issues (errors) and I'm not sure why they appears only now.Here the header of my class:
#ifndef OPENAMP_H #define OPENAMP_H #include <QObject> #include <QQueue> #include <QSerialPort> class OpenAMP : public QSerialPort { Q_OBJECT public: typedef enum { Closed, Open, Error } States; explicit OpenAMP(QObject *parent = nullptr); ~OpenAMP(); using QSerialPort::open; void closePort(); private: QQueue<QByteArray> _queue; void dequeue(); void writeMessage(QByteArray data); signals: void lineReceived(QByteArray line); void stateChanged(QString port, OpenAMP::States state); private slots: void onReadyRead(); public slots: void openPort(); void sendMessage(QByteArray data); }; Q_DECLARE_METATYPE(OpenAMP::States) #endif // OPENAMP_H
Is there something new in Qt code guidelines? Perhaps my code is formally correct (because it compiles and runs) but discouraged in any way?
-
@Mark81 said in Lot of errors but it builds and runs successfully:
for Linux (Ubuntu).
Trying to build a code I've used for years now I get a new behavior of the IDE.The new behaviour is caused by the new Clang Code Model.
See https://forum.qt.io/topic/100762/qt-creator-clang-code-model-problems-collection/ -- You can disable the Clang Code Model and revert to the old behaviour.
The code is compiled without any error and works as expected but the editor is full of issues (errors) and I'm not sure why they appears only now.
The Clang Code Model uses a desktop compiler to parse the code. The desktop compiler's environment settings are different from your cross-compiler's environment settings, which is probably why it encounters errors.
Notice that the false errors are marked by a red circle with a black center. Real errors that are produced by your cross-compiler will be marked by a solid red circle with a red center.
-
@JKSH said in Lot of errors but it builds and runs successfully:
The desktop compiler's environment settings are different from your cross-compiler's environment settings, which is probably why it encounters errors.
I'm facing the same problem but with Qt 6.5.2 and Qt Creator 11.0.0 on a Mac. Isn't there a way to modify the desktop compiler's environment settings?
-
-
-
@SuperSelrak. This bug has been fixed in Qt Creator 11.0.1.
Btw, are you using CMake for your project? If so, what version?
-
@Mehrshad Thank you. What's the earliest version you know that it has been fixed in ? I don't want to spend the time jumping to a new Qt Creator - either I have to do it on my own and deal with the issues that will surely come up, or wait for the support people to do it.
Yes I use CMake 3.27.7. Why ?
-
@SuperSelrak, as I stated earlier, the bug has been fixed in Qt Creator 11.0.1.
If you are not willing to update Qt Creator, try CMake 3.26.x or earlier.
Let me know if the problem still persists.