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. error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
Servers for Qt installer are currently down

error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 783 Views
  • 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.
  • M Offline
    M Offline
    masa4
    wrote on last edited by
    #1

    I am developing a qt project, with some generic classes that use glib. Because of this i was getting error about signals but i solved it with adding #undef signals #define signals keywords before and after glib includes. Now i started to add this generic headers to my headers. My include hierarchy like this:
    HEADER1(generic header file):

    #undef signals
    #include <glib.h>
    ...
    #define signals
    

    HEADER2(generic class' header):

    #include "header1.h"
    

    HEADER3(my class header):

    #include "header2.h"
    

    But now i am again in trouble with signals keyword. When i built it i got

    ../../myproj/header3.h:39:5: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
    ../../myproj/header3.h:38:8: error: expected ‘;’ at end of member declaration
       38 | signals:
    

    When i include header2 to my .cpp, i dont get this error. when including it to my header files, i got error and It gives me "signals" redefined warning too. How can i work around the issue? What is wrong now?

    J.HilkJ 1 Reply Last reply
    0
    • M masa4

      I am developing a qt project, with some generic classes that use glib. Because of this i was getting error about signals but i solved it with adding #undef signals #define signals keywords before and after glib includes. Now i started to add this generic headers to my headers. My include hierarchy like this:
      HEADER1(generic header file):

      #undef signals
      #include <glib.h>
      ...
      #define signals
      

      HEADER2(generic class' header):

      #include "header1.h"
      

      HEADER3(my class header):

      #include "header2.h"
      

      But now i am again in trouble with signals keyword. When i built it i got

      ../../myproj/header3.h:39:5: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
      ../../myproj/header3.h:38:8: error: expected ‘;’ at end of member declaration
         38 | signals:
      

      When i include header2 to my .cpp, i dont get this error. when including it to my header files, i got error and It gives me "signals" redefined warning too. How can i work around the issue? What is wrong now?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @masa4 see this section of the documentation:
      https://doc.qt.io/qt-6/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots

      in essence, "Disable" qt signals and slots keywords and replace them with Q_SIGNALS and QSLOTS


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      M 1 Reply Last reply
      2
      • J.HilkJ J.Hilk

        @masa4 see this section of the documentation:
        https://doc.qt.io/qt-6/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots

        in essence, "Disable" qt signals and slots keywords and replace them with Q_SIGNALS and QSLOTS

        M Offline
        M Offline
        masa4
        wrote on last edited by
        #3

        @J-Hilk Thanks, I didnt want to replace them but in the end i did it. This one is most painless solution.

        1 Reply Last reply
        1

        • Login

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