Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error with QNetworkSession::interface()
Qt 6.12 LTS 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.9k 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.
  • jsulmJ jsulm

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

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

    @jsulm how to find rpc.h ? this is not part of my project, it is Microsoft Remote Procedure Call.

    jsulmJ RatzzR 2 Replies Last reply
    0
    • ODБOïO ODБOï

      @jsulm how to find rpc.h ? this is not part of my project, it is Microsoft Remote Procedure Call.

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

      @LeLev Can you post the whole build log?

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

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

        @jsulm how to find rpc.h ? this is not part of my project, it is Microsoft Remote Procedure Call.

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

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

        how to find rpc.h ?

        For me its present in C:\Qt\Qt5.9.3\Tools\mingw530_32\i686-w64-mingw32\include and 12 th line says #define interface struct

        --Alles ist gut.

        1 Reply Last reply
        3
        • jsulmJ jsulm

          @LeLev Can you post the whole build log?

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

          @jsulm

          C:/Qt/Tools/mingw730_64/bin/mingw32-make -f Makefile.Release
          mingw32-make[1]: Entering directory 'C:/Users/lev/Documents/build-udp_inspector-Desktop_Qt_5_12_0_MinGW_64_bit-Release'
          g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\CN16K_Spyer -I. -I..\LIB\SSH_Lib\SSH_files -I..\CN16K_SFTP -I..\..\..\..\Qt\5.12.0\mingw73_64\include -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtQuick -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtWidgets -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtGui -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtANGLE -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtQml -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtNetwork -I..\..\..\..\Qt\5.12.0\mingw73_64\include\QtCore -Irelease -I\include -I..\..\..\..\Qt\5.12.0\mingw73_64\mkspecs\win32-g++  -o release\main.o ..\CN16K_Spyer\main.cpp
          In file included from C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/include/oleidl.h:7:0,
                           from C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/include/ole2.h:38,
                           from C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/include/wtypes.h:12,
                           from C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/include/winscard.h:10,
                           from C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/include/windows.h:97,
                           from C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/include/winsock2.h:23,
                           from ..\LIB\SSH_Lib\SSH_files/libssh.h:64,
                           from ..\LIB\SSH_Lib\SSH_files/sftp.h:42,
                           from ..\CN16K_SFTP/cn16k_sftp.h:7,
                           from ..\CN16K_Spyer\fileloader.h:7,
                           from ..\CN16K_Spyer\main.cpp:11:
          ..\CN16K_Spyer\main.cpp: In function 'int qMain(int, char**)':
          ..\CN16K_Spyer\main.cpp:33:38: error: expected unqualified-id before 'struct'
               QNetworkInterface intr = session.interface();
                                                ^
          mingw32-make[1]: *** [Makefile.Release:767: release/main.o] Error 1
          mingw32-make[1]: Leaving directory 'C:/Users/lev/Documents/build-udp_inspector-Desktop_Qt_5_12_0_MinGW_64_bit-Release'
          mingw32-make: *** [Makefile:36: release] Error 2
          11:33:31: Le processus "C:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" s'est terminé avec le code 2.
          Erreur lors de la compilation/déploiement du projet udp_inspector (kit : Desktop Qt 5.12.0 MinGW 64-bit)
          When executing step "Make"
          
          1 Reply Last reply
          0
          • 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
                              • Unsolved