Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Expected constructor, destructor, or type conversion before ‘(’ token Error
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 6.4k Views 1 Watching
  • 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    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
    0
    • R Offline
      R Offline
      RazrFalcon
      wrote on last edited by
      #2

      @QT_DECLARE_INTERFACE@
      and
      @
      ActionInterface@

      not needed "*"

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved