Results 1 to 7 of 7

Thread: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

  1. #1
    Join Date
    Aug 2021
    Posts
    4
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    Dear my friends of Qt-Community.

    I'm stucked on this error-message as I am building 2 windows (1 as parent-window and 1 as child-window) and MenuBar (with QMenuBar and QMenu). The error-message as compiling-process is here:
    "
    ceo@sally:/mnt/slax/fileserver-slax/arsip/SoftDev/ERPLinux$ make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt/mkspecs/linux-g++ -I. -I/usr/lib64/qt/include/QtCore -I/usr/lib64/qt/include/QtGui -I/usr/lib64/qt/include -I. -I. -o ERPLinux.o ERPLinux.cpp
    In file included from ERPLinux.cpp:1:0:
    ERPLinux.h:15:14: Fehler: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]
    bikinmenupos(){
    ^
    ERPLinux.h: In Funktion »int bikinmenupos()«:
    ERPLinux.h:18:3: Fehler: »berkaspos« wurde in diesem Gültigkeitsbereich nicht definiert
    berkaspos = menupos->addMenu("&POS");
    ^
    ERPLinux.h:16:13: Warnung: Variable »menuutama« wird nicht verwendet [-Wunused-variable]
    QMenuBar *menuutama = new QMenuBar();
    ^
    ERPLinux.h:19:1: Warnung: keine return-Anweisung in nicht void zurückgebender Funktion [-Wreturn-type]
    }
    ^
    ERPLinux.cpp: In Funktion »int main(int, char**)«:
    ERPLinux.cpp:8:11: Fehler: expected unqualified-id before »->« token
    ERPLinux->bikinmenupos();
    ^
    Makefile:214: die Regel für Ziel „ERPLinux.o“ scheiterte
    make: *** [ERPLinux.o] Fehler 1
    ceo@sally:/mnt/slax/fileserver-slax/arsip/SoftDev/ERPLinux$
    ".

    "Fehler: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]" means -> "Error: ISO-C++ declared from »bikinmenupos« without Type [-fpermissive]".
    "Fehler: »berkaspos« wurde in diesem Gültigkeitsbereich nicht definiert" means -> "Error: »berkaspos« defined not in corrent region/position.

    These are my simple-sourcecode (4-files):
    -------------------------
    1. file of ERPLinux.h
    #include <QApplication>
    #include <QWidget>
    #include <QMenuBar>
    #include <QMenu>

    class QAction;
    class ERPLinux : public QWidget{
    Q_OBJECT
    public:

    private:

    };

    bikinmenupos(){
    QMenuBar *menuutama = new QMenuBar();
    QMenu *menupos = new QMenu();
    berkaspos = menupos->addMenu("&POS");
    }

    2. file of ERPLinux.cpp
    #include "ERPLinux.h"
    #include "POS.h"

    int main(int argc, char *argv[]){
    QApplication *aplikasi = new QApplication(argc, argv);
    QWidget *jendelautama = new QWidget();
    jendelautama->setWindowTitle("ERP for Windows, Linux and Android by ELEKTRO.asia");
    ERPLinux->bikinmenupos();

    jendelautama->show();
    POS *layarpos = new POS();
    layarpos->show();
    aplikasi->exec();
    }

    3. file of POS.h
    #include <QWidget>

    class QAction;
    class POS : public QWidget{

    public:

    };

    4. file of POS.cpp
    #include "POS.h"

    int main(int argc, *char argv[]){

    }
    -----------------------------------

    Would anyone please help me to show where my mistakes I've done?

    Thank you very much in advance.
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    Hi, your bikinmenupos() function does not have a return value. If you don't want to return anything it should be "void bikinmenupos()".

    Ginsengelf

  3. #3
    Join Date
    Aug 2021
    Posts
    4
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    Liebe Ginsengelf.

    Thank you very much for your advise. I have put "void bikinmenupos(){...}".

    And now I am still trouble-shooting these error-message:
    "
    ceo@sally:/mnt/slax/fileserver-slax/arsip/SoftDev/ERPLinux$ make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt/mkspecs/linux-g++ -I. -I/usr/lib64/qt/include/QtCore -I/usr/lib64/qt/include/QtGui -I/usr/lib64/qt/include -I. -I. -o ERPLinux.o ERPLinux.cpp
    In file included from ERPLinux.cpp:1:0:
    ERPLinux.h: In Funktion »void bikinmenupos()«:
    ERPLinux.h:18:3: Fehler: »berkaspos« wurde in diesem Gültigkeitsbereich nicht definiert
    berkaspos = menupos->addMenu("&POS");
    ^
    ERPLinux.h:16:13: Warnung: Variable »menuutama« wird nicht verwendet [-Wunused-variable]
    QMenuBar *menuutama = new QMenuBar();
    ^
    ERPLinux.cpp: In Funktion »int main(int, char**)«:
    ERPLinux.cpp:8:11: Fehler: expected unqualified-id before »->« token
    ERPLinux->bikinmenupos();
    "


    Added after 16 minutes:


    Liebe Ginsengelf....

    Now I still have 2 error-message left to be solved. I change my file of ERPLinux.h like this:
    "
    #include <QApplication>
    #include <QWidget>
    #include <QMenuBar>
    #include <QMenu>

    class QAction;
    class ERPLinux : public QWidget{
    Q_OBJECT
    public:

    private:

    };

    void ERPLinux::bikinmenupos(){
    QMenuBar *menuutama = new QMenuBar();
    QMenu *menupos = new QMenu();
    berkaspos = menupos->addMenu("&POS");
    }
    "

    I still have these 2problems
    "
    ERPLinux.h:15:29: Fehler: keine Elementfunktion »void ERPLinux::bikinmenupos()« in Klasse »ERPLinux« deklariert
    " means
    "
    ERPLinux.h:15:29: Error: no functionelement »void ERPLinux::bikinmenupos()« declared in class of »ERPLinux«
    "
    Last edited by opentek; 24th August 2021 at 18:17.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    ERPLinux.h:15:29: Fehler: keine Elementfunktion »void ERPLinux::bikinmenupos()« in Klasse »ERPLinux« deklariert
    " means
    "
    ERPLinux.h:15:29: Error: no functionelement »void ERPLinux::bikinmenupos()« declared in class of »ERPLinux«
    "
    Are you actually reading your compiler's error messages?

    Your "ERPLinux" class is completely empty. You haven't declared any methods or variables in it. If you want "bikinmenupos()" to be a member function of this class, then you have to declare it inside of the class definition.

    I think you need to go back to your C++ books and read again about classes and class definitions.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Aug 2021
    Posts
    4
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    Dear dstanz

    Not completely empty, isn't it? I defined
    "
    void ERPLinux::bikinmenupos(){
    QMenuBar *menuutama = new QMenuBar();
    QMenu *menupos = new QMenu();
    berkaspos = menupos->addMenu("&POS");
    }
    "
    and I call
    "
    ERPLinux->bikinmenupos();
    " from ERPLinux.cpp .

    I shouldn't go-back to my C++ book yet but I better go-back to wxWidget as I usually use GUI-lib for writing my application in C++.

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    Not completely empty, isn't it?
    Yes, it is. This is a completely empty declaration of the class ERPLinux. All you have done here is to say it is a class publicly derived from QWidget. The only actual content is the Q_OBJECT macro.

    Qt Code:
    1. class ERPLinux : public QWidget{
    2. Q_OBJECT
    3. public:
    4.  
    5. private:
    6.  
    7. };
    To copy to clipboard, switch view to plain text mode 

    I defined
    Qt Code:
    1. void ERPLinux::bikinmenupos(){
    2. QMenuBar *menuutama = new QMenuBar();
    3. QMenu *menupos = new QMenu();
    4. berkaspos = menupos->addMenu("&POS");
    5. }
    To copy to clipboard, switch view to plain text mode 

    This is not the way you declare a class member function. It must be declared within the body of the class declaration:

    Qt Code:
    1. class ERPLinux : public QWidget{
    2. Q_OBJECT
    3. public:
    4. void bikinmenupos();
    5.  
    6. private:
    7.  
    8. };
    To copy to clipboard, switch view to plain text mode 

    and then you can define (implement) it, usually in the .cpp file that corresponds to your .h file, or as inline in your .h file.

    And this line:

    Qt Code:
    1. berkaspos = menupos->addMenu("&POS");
    To copy to clipboard, switch view to plain text mode 

    won't compile because you have not declared a variable named "berkaspos".

    Likewise, your class "POS" is also completely empty.

    And this:

    Qt Code:
    1. ERPLinux->bikinmenupos();
    To copy to clipboard, switch view to plain text mode 

    is not the way you call a member function of the class ERPLinux. Which is why you need to go back to your C++ book.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. #7
    Join Date
    Aug 2021
    Posts
    4
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: ISO-C++ verbietet Deklaration von »bikinmenupos« ohne Typ [-fpermissive]

    Dear d_stanz...

    Thank you very much for your advises..... I am retrying to progress my sourcecode now.

Similar Threads

  1. Replies: 2
    Last Post: 18th January 2017, 11:35

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.