Expected constructor, destructor, or type conversion before ‘(’ token Error



  • I am developing an app which can be extended through the plugins. I created a small plugin which return an QAction object and it is added to menu. Ok , so the problems is that i get this error

    /home/parallels/Documents/GUI-build-desktop/../GUI/actioninterface.h:15: error: expected constructor, destructor, or type conversion before ‘(’ token

    @#ifndef ACTIONINTERFACE_H
    #define ACTIONINTERFACE_H

    #include <QAction>

    class ActionInteface {

    public:
    virtual ~ActionInteface() {}
    ActionInteface();
    virtual QAction newAction () = 0;

    };

    QT_DECLARE_INTERFACE(ActionInterface,"com.stefan.Plugin.ActionInterface/1.0"); // line 15

    #endif // ACTIONINTERFACE_H
    @

    Seems this cause another issue

    /home/parallels/Documents/GUI-build-desktop/../GUI/MainWindow.h:56: error: ‘ActionInterface’ does not name a type

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <QAction>
    #include <QLabel>
    #include <QMenu>
    #include "actioninterface.h" // interface header

    class MainWindow : public QMainWindow {
    //Macros necesar pentru declararea propriilor(clasei) SIGNALS si SLOTS
    Q_OBJECT

    // many declarations
    //
    //

    ActionInterface *newAction; // here a get second error 
    

    };
    #endif@

    Actually it's about C++ but anyway , what i am missing at this point ?



  • @QT_DECLARE_INTERFACE@
    and
    @
    ActionInterface@

    not needed "*"



  • Two typos:

    • it is Q_DECLARE_INTERFACE (not QT_)
    • your class is named ActionInteface - an r is missing in Interface

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.