Unsolved C4005: 'AF_IPX' : macro redefinition
-
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'
-
@SPlatten You did not provide any context.
What do you compile?
On what OS?
Which Qt version?
Which compiler? -
@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?
-
@SPlatten Where in your project does the error come from? I mean from which source/header file.
-
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...
-
@SPlatten Could it be related to missing include guards: https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h ?
-
@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
-
So after my last edit, the problem has changed now I get:
C2146: syntax error: missing ';' before identifier 'IWbemClassObject'
-
@SPlatten Without seeing the code...
-
@jsulm , sorry its difficult because there is a lot of it.
-
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)
-
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;
-
The solution is as always - either give a compilable example or reduce your code until the error goes away.