If you look at MSDN, it's actually _WIN32 is the only macro really
mentioned anywhere. WIN32 is defined by most Visual studio projects at that
level, not the compiler. So in my eyes, changing code to check for _WIN32
is the only right thing to do.

Ruben

Op 12 okt. 2017 9:11 a.m. schreef "Frédéric" <[email protected]>:

> Hi,
>
> I am using mingw w64 5.0.2 on a linux machine with gcc/g++ 7.2.0.
> I noticed that the macro WIN32 is:
> - defined if -std=gnu++{98,11,14,17}
> - not defined if -std=c++{98,11,14,17}
>
> why such difference?
>
> A library I try to cross-compile tests for WIN32 and fails. I have to
> manually change all WIN32 in _WIN32.
>
> From what I understand, macros without _ are the responsability of
> w64, not gcc but I may be wrong.
>
> F
>
> Here is how I test (foo.cpp is an empty file):
> for o in c gnu; do for y in 98 11 14 17; do echo "-std=${o}++${y}";
> x86_64-w64-mingw32-g++-7.2.0 -E -dM -O3 -std=${o}++${y} foo.cpp|grep
> WIN32; done; done
> -std=c++98
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> -std=c++11
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> -std=c++14
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> -std=c++17
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> -std=gnu++98
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> #define WIN32 1
> -std=gnu++11
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> #define WIN32 1
> -std=gnu++14
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> #define WIN32 1
> -std=gnu++17
> #define _WIN32 1
> #define __WIN32 1
> #define __WIN32__ 1
> #define WIN32 1
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to