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.

    issues.jpg

    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?


  • Moderators

    @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.


Log in to reply