Greetings everybody. I'm building a cross-compiler for i686-pc-mingw32 on x86_64 linux from source. Already built a C compiler and libgcc I can successfully create Windows executables from C source. Now I want to build the C++ compiler, but it fails, because min and max are defined in windef.h and it seems that it's included somewhere and I don't know where to go from here. I saw the #define NOMINMAX 1 in os_defines.h but it seems windef.h is included before that. Trying to build GCC like this: ../configure --prefix=/home/axtroz/Win32 --target=i686-pc-mingw32 --enable- languages=c,c++ --enable-shared enable-languages=c,c++ --enable-shared make all-gcc # C compiler make install-gcc # Install it make all-target-libgcc # GCC library make install-target-libgcc # Install it make all # To build the rest # Fails with about 1600 lines of errors and warnings Here's from where things go wrong: make[3]: Entering directory `/home/axtroz/source/MinGW- Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3' Making all in include make[4]: Entering directory `/home/axtroz/source/MinGW- Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include' mkdir -p ./i686-pc-mingw32/bits/stdc++.h.gch /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/./gcc/xgcc -shared-libgcc - B/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/./gcc -nostdinc++ - L/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/src -L/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc- mingw32/libstdc++-v3/src/.libs -L/home/axtroz/source/MinGW- Cross/gcc-4.7.1/bld3/i686-pc-mingw32/winsup/mingw -L/home/axtroz/source/MinGW- Cross/gcc-4.7.1/bld3/i686-pc-mingw32/winsup/w32api/lib -isystem /home/axtroz/source/MinGW-Cross/gcc-4.7.1/winsup/mingw/include -isystem /home/axtroz/source/MinGW-Cross/gcc-4.7.1/winsup/w32api/include - B/home/axtroz/Win32/i686-pc-mingw32/bin/ -B/home/axtroz/Win32/i686-pc- mingw32/lib/ -isystem /home/axtroz/Win32/i686-pc-mingw32/include -isystem /home/axtroz/Win32/i686-pc-mingw32/sys-include -x c++-header -nostdinc++ -g - O2 -I/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/i686-pc-mingw32 -I/home/axtroz/source/MinGW- Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include - I/home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++-v3/libsupc++ -O2 -g - std=gnu++0x /home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++- v3/include/precompiled/stdc++.h \ -o i686-pc-mingw32/bits/stdc++.h.gch/O2ggnu++0x.gch In file included from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc- mingw32/libstdc++-v3/include/bits/stl_algo.h:62:0, from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc- mingw32/libstdc++-v3/include/algorithm:63, from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++- v3/include/precompiled/stdc++.h:65: /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/bits/algorithmfwd.h:360:41: error: macro "max" passed 3 arguments, but takes just 2 /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/bits/algorithmfwd.h:371:41: error: macro "min" passed 3 arguments, but takes just 2 /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/bits/algorithmfwd.h:394:30: error: macro "min" requires 2 arguments, but only 1 given /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/bits/algorithmfwd.h:402:30: error: macro "max" requires 2 arguments, but only 1 given In file included from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc- mingw32/libstdc++-v3/include/random:43:0, from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc- mingw32/libstdc++-v3/include/bits/stl_algo.h:67, from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc- mingw32/libstdc++-v3/include/algorithm:63, from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++- v3/include/precompiled/stdc++.h:65: /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/limits:309:11: error: macro "min" requires 2 arguments, but only 1 given /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++- v3/include/limits:313:11: error: macro "max" requires 2 arguments, but only 1 given