⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

many incomprehensible errors

  • Hello, trying to compile project, I receive many errors but I don't understand why because the code is simple and that is no reason to get this ...

    here the mainwindow.h for exemple:

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include <QMainWindow>
    #include <QPixmap>
    #include <QTimer>
    #include <iostream>
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/core/core.hpp>
    using std::cout;
    using std::endl;
    class Vehicule;
    class Alarme;
    class Camera;
    class ThreadCam;
    namespace Ui {
    class MainWindow;
    class MainWindow : public QMainWindow
        explicit MainWindow(QWidget *parent = 0);
        ThreadCam* threadCamera;
        QPixmap qPixVoySurvitesse, qPixVoyBlack, qPixLogo;
        Vehicule* monVehicule;
        Alarme* monAlarme;
        Ui::MainWindow *ui;
        QTimer* timerRefreshVit;
        QTimer* timerFps;
        QTimer* timerLaunchedThread;
    public slots:
        void sltReceiveCamImage(QPixmap img);
        void sltRefreshCompteur();
        void sltShowAlarmeVoyantTick();
        void sltHideAlarmeVoyantTick();
        void sltReceiveCamFps(int framePerSecond);
        void sltCamNotFound();
    private slots:
        void on_cvPRondAvertVisu_clicked(bool checked);
        void on_cvPRondAvertSon_clicked(bool checked);
        void on_sliderCompteur_sliderMoved(int position);
    #endif // MAINWINDOW_H

    the .pro file had
    QT += core gui multimedia widgets qml

    and here the errors return by Qt creator:


    Could you help me to understand where errors are come from?...

    thank you very much

  • Lifetime Qt Champion

    @filipdns These errors come from the Clang Code Model, which I assume has problems parsing one of the headers you included.

    Does it work with a default created project from the wizard ("Qt Widgets Application")?

    Which Qt creator version are you using on which platform?

  • @aha_1980 hi aha, I'm on windows 10, Qt 5.11 MSVC2015 / 64 and yes created default project work fine...

  • Lifetime Qt Champion


    The code model might have problems with the OpenCV headers.

    You can try to use the latest version of Qt Creator (you didn't mention which version you actually using). If that does not help, you can disable Clang with Help > About Plugins > Clang Code Model.

  • @aha_1980 I'm using creator 4.8.2, disable Clang don't show errors any more but I still don't know why I get theses errors on this project and not on other one...

  • Lifetime Qt Champion

    @filipdns As said, most often the problems arise when a header file cannot be parsed correctly. Debugging these problems is a tedious task, though.

    If you want to do it, start with a minimal project, then start adding the OpenCV headers in a .cpp file. At some point it will start to break. Then at least you know the guilty header and can investigate more.


Log in to reply