Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

error: 'Q_DECL_OVERRIDE' does not name a type



  • Hi!
    I'm new of QT world, so I'm trying this example Mandelbrot Example.
    I have copy accurately the example but i get this error:

    error: 'Q_DECL_OVERRIDE' does not name a type

    I use Kubuntu 16.04 with Qt Creator 3.5.1 installed by repo.
    Thanks for any hints!


  • Lifetime Qt Champion

    That is odd. Your compiler should be pretty new.
    This is the exact sample?

    You can remove it. It "just" informs you if u dont really override anything.

    Hmm what version of Qt did u install?
    Qt 5?
    Check with qmake -v



  • $ qmake -v
    QMake version 2.01a
    Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu



  • Hi @deglans
    I guess there is a issue with copying, So you can try like this,
    In Qt Creator Examples(welcome > Examples) search for "Mandelbrot". Open it and compile it. This may help to find the issue.


  • Lifetime Qt Champion

    Hi,

    That's because you are trying to build an example that's been update for Qt 5 with Qt 4.

    Q_DECL_OVERRIDE has been introduced in Qt 5.



  • I have solved by installing some package (qt5-default, qtbase5, qttools5) so now i get:

    $ qmake -v
    QMake version 3.0
    Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu

    Then from the IDE Tools > Options > Build & Run > Kits > Qt Version I have selected Qt5
    Now all works fine, thanks.



  • Hi tried doing the things given in the last reply.
    qt5-default was installed.
    but got following error for qt5base:-
    sudo apt-get install qtbase5
    [sudo] password for rohit:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package qtbase5

    any help?



  • I added "-dev" in package name and it got installed. But still I am getting the error - error: 'Q_DECL_OVERRIDE' does not name a type. Please help.


  • Lifetime Qt Champion

    Did you change the Kit used to build the example ?



  • Put Q_DECL_OVERRIDE after method declaration, not before it.
    Sample from Qt Doc

    virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
    

Log in to reply