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. C4005: 'AF_IPX' : macro redefinition
Forum Updated to NodeBB v4.3 + New Features

C4005: 'AF_IPX' : macro redefinition

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 3 Posters 2.1k 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    I've searched online for a solution to this and the recommendation was to add:

    #ifndef AF_IPX
        #ifndef WIN32_LEAN_AND_MEAN
            #define WIN32_LEAN_AND_MEAN
        #endif
        #ifndef WIN32
            #define WIN32
        #endif
        #include <WinSock2.h>
        #include <Windows.h>
    #endif
    

    I've tried this and whilst it seems to work in some cases, not all. I'm still getting this warning during compile and I cannot see why.

    [Edit] After changing the content above, the error is now:

    C2146: syntax error: missing ';' before identifier 'IWbemClassObject'
    

    Kind Regards,
    Sy

    jsulmJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I've searched online for a solution to this and the recommendation was to add:

      #ifndef AF_IPX
          #ifndef WIN32_LEAN_AND_MEAN
              #define WIN32_LEAN_AND_MEAN
          #endif
          #ifndef WIN32
              #define WIN32
          #endif
          #include <WinSock2.h>
          #include <Windows.h>
      #endif
      

      I've tried this and whilst it seems to work in some cases, not all. I'm still getting this warning during compile and I cannot see why.

      [Edit] After changing the content above, the error is now:

      C2146: syntax error: missing ';' before identifier 'IWbemClassObject'
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @SPlatten You did not provide any context.
      What do you compile?
      On what OS?
      Which Qt version?
      Which compiler?

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

      1 Reply Last reply
      0
      • SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @jsulm , sorry, I'm compiling on Windows 10 using Qt Creator and Qt 5.8, the compile is Microsoft I have a couple of versions installed, MSVC 2013 and 2017, I think its using 2013.

        Its a large project which I'm converting from Qt 4.8 to Qt 5.8. Hope that helps?

        Kind Regards,
        Sy

        jsulmJ 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @jsulm , sorry, I'm compiling on Windows 10 using Qt Creator and Qt 5.8, the compile is Microsoft I have a couple of versions installed, MSVC 2013 and 2017, I think its using 2013.

          Its a large project which I'm converting from Qt 4.8 to Qt 5.8. Hope that helps?

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

          @SPlatten Where in your project does the error come from? I mean from which source/header file.

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

          1 Reply Last reply
          0
          • SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #5

            It seems to come from several files all of which are specific to this project. The problem seems to be moving and changing as I fix one thing another results...see edit which I'm about to do...

            Kind Regards,
            Sy

            jsulmJ 1 Reply Last reply
            0
            • SPlattenS SPlatten

              It seems to come from several files all of which are specific to this project. The problem seems to be moving and changing as I fix one thing another results...see edit which I'm about to do...

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

              @SPlatten Could it be related to missing include guards: https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h ?

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

              SPlattenS 1 Reply Last reply
              0
              • jsulmJ jsulm

                @SPlatten Could it be related to missing include guards: https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h ?

                SPlattenS Offline
                SPlattenS Offline
                SPlatten
                wrote on last edited by
                #7

                @jsulm I do have guards in the headers, I always start off with:

                #ifndef WIN_H // or whatever I call it
                    #define WIN_H
                
                //Content of header
                
                
                
                #endif
                

                Kind Regards,
                Sy

                1 Reply Last reply
                0
                • SPlattenS Offline
                  SPlattenS Offline
                  SPlatten
                  wrote on last edited by
                  #8

                  So after my last edit, the problem has changed now I get:

                  C2146: syntax error: missing ';' before identifier 'IWbemClassObject'
                  

                  Kind Regards,
                  Sy

                  jsulmJ 1 Reply Last reply
                  0
                  • SPlattenS SPlatten

                    So after my last edit, the problem has changed now I get:

                    C2146: syntax error: missing ';' before identifier 'IWbemClassObject'
                    
                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @SPlatten Without seeing the code...

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

                    1 Reply Last reply
                    0
                    • SPlattenS Offline
                      SPlattenS Offline
                      SPlatten
                      wrote on last edited by
                      #10

                      @jsulm , sorry its difficult because there is a lot of it.

                      Kind Regards,
                      Sy

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        I wonder what's Qt related here but you're missing a semicolon at the end of a class (mostly the class from the last include before IWbemClassObject)

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        0
                        • SPlattenS Offline
                          SPlattenS Offline
                          SPlatten
                          wrote on last edited by
                          #12

                          The whole project is Qt related, granted particular error might not be, I'm just trying to get some assistance. The header that IWbemClassObject is defined in is a Microsoft header, and its path is:

                              C:\Program Files (x86)\Windows Kits\8.1\Include\um\WbemCli.h
                          

                          I've looked at the header and it is a typical error message that has nothing to do with the issue. The line line has the error on it is:

                              typedef interface IWbemClassObject IWbemClassObject;
                          

                          Kind Regards,
                          Sy

                          1 Reply Last reply
                          0
                          • Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            The solution is as always - either give a compilable example or reduce your code until the error goes away.

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            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