Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

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

    General and Desktop
    2
    3
    6024
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      Guest last edited by

      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 ?

      1 Reply Last reply Reply Quote 0
      • R
        RazrFalcon last edited by

        @QT_DECLARE_INTERFACE@
        and
        @
        ActionInterface@

        not needed "*"

        1 Reply Last reply Reply Quote 0
        • G
          goetz last edited by

          Two typos:

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

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply Reply Quote 0
          • First post
            Last post