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 with QNetworkSession::interface()
Qt 6.11 is out! See what's new in the release blog

Error with QNetworkSession::interface()

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 3 Posters 3.7k 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.
  • ODБOïO ODБOï

    Hi,
    i had this code running with Qt5.11

     QNetworkSession session ( conf );
     QNetworkInterface intr = session.interface();
    

    now, with Qt5.12 this will note compile.

    i have this :

    main.cpp:44: erreur : expected unqualified-id before 'struct'
         QNetworkInterface intr = session.interface();
            
    main.cpp:44: erreur : expected unqualified-id                              ^
    
    Parse issue  : rpc.h:12:19:note: expanded from macro 'interface'
    

    What is the probleme please ?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by jsulm
    #7

    @LeLev said in Error with QNetworkSession::interface():

    QNetworkInterface intr = session.interface();

    Is it a typo? Should be int not intr.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    ODБOïO 1 Reply Last reply
    0
    • jsulmJ jsulm

      @LeLev said in Error with QNetworkSession::interface():

      QNetworkInterface intr = session.interface();

      Is it a typo? Should be int not intr.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #8

      @jsulm i named it 'intr' for 'interface'

      jsulmJ 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @jsulm i named it 'intr' for 'interface'

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #9

        @LeLev Forget my comment, somehow I managed to read this line in a wrong way :-)

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • jsulmJ jsulm

          @LeLev Do you have a macro in rpc.h called "interface"?

          RatzzR Offline
          RatzzR Offline
          Ratzz
          wrote on last edited by
          #10

          @LeLev
          Error with QNetworkSession::interface():

          Do you have a macro in rpc.h called "interface"?

          Can you check this ?

          --Alles ist gut.

          1 Reply Last reply
          0
          • ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on last edited by ODБOï
            #11

            @Ratzz yes, there is

            
            #include <_mingw.h>
            
            #ifndef __OBJC__
            #undef interface
            #define interface struct
            #endif
            

            in my C:\Qt\Tools\mingw730_64\x86_64-w64-mingw32\include

            1 Reply Last reply
            0
            • ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by
              #12

              This solved the probleme

                  QNetworkSession session ( conf );
                  #undef interface
                  QNetworkInterface intr = session.interface();
              

              Thank you @jsulm and @Ratzz

              jsulmJ 1 Reply Last reply
              0
              • ODБOïO ODБOï

                This solved the probleme

                    QNetworkSession session ( conf );
                    #undef interface
                    QNetworkInterface intr = session.interface();
                

                Thank you @jsulm and @Ratzz

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by jsulm
                #13

                @LeLev This is strange. You're not building for MacOS.

                __OBJC__
                

                is defined when building for MacOS, see https://stackoverflow.com/questions/2054669/objc-in-objective-c

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                ODБOïO 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @LeLev This is strange. You're not building for MacOS.

                  __OBJC__
                  

                  is defined when building for MacOS, see https://stackoverflow.com/questions/2054669/objc-in-objective-c

                  ODБOïO Offline
                  ODБOïO Offline
                  ODБOï
                  wrote on last edited by
                  #14

                  @jsulm yes i'm building for windows.

                  jsulmJ 1 Reply Last reply
                  0
                  • ODБOïO ODБOï

                    @jsulm yes i'm building for windows.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #15

                    @LeLev Do you have anything related to MacOS in your pro file?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    ODБOïO 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @LeLev Do you have anything related to MacOS in your pro file?

                      ODБOïO Offline
                      ODБOïO Offline
                      ODБOï
                      wrote on last edited by
                      #16

                      @jsulm no, nothing

                      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