I explained a problem with min and max macros. Gary R. Van Sickle <[EMAIL PROTECTED]> wrote: > I just included <algorithm>, which contains min and max templates, > and had no problem compiling those files.
Which made me realize that it wasn't macros that Robert Collins was intending when he wrote that code - it was the functions from <algorithm>. Therefore the solution is obvious:- replace min with std::min, so the compiler accepts it, and define NOMINMAX before including <windows.h> to prevent polluting the namespace in a way which really upsets libstdc++-v3. Gary also wrote: > I haven't gotten to the link stage though.... I have. Full patchset attached. I'd be interested in verification that it all works for someone else. The set of patches attatched applies to setup CVS HEAD (2.281), and allows setup to build with: ./configure -C --enable-dependencies --disable-shared --host=i686-pc-mingw32 --build=i686-pc-cygwin CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" --enable-maintainer-mode make (That is the configure line from the setup webpage, adapted to gcc3 by dropping the CPPFLAGS definition (no longer needed).) Please comment on these patches, and then I will make any changes people suggest, write up a ChangeLog, and request they be committed. fix-gcc3-main.patch - Addition of std:: prefixes, using std::type directives, tightening up of a throw() specification, adding NOMINMAX as mentioned above. fix-gcc3-libgetopt++.patch - Addition of std:: prefixes in the libgetopt++ directory. fix-gcc3-dodgy-NULL-streambuf.patch - A rather horrid hack, but I believe it only does explicitly what was done implicitly before, but now must be stated explicitly because of a tightening up of libstdc++. fix-gcc2.patch - A couple of minor fixes to allow compilation with gcc2, for comparison's sake. fix-res.rc-bad-comment.patch - Change a # comment to a // comment (Someone was thinking shell-script, not C). fix-CFLAGS+=-Wno-deprecated.patch - Needed to avoid warnings about deprecated strstreams, and since we are using -Werror ... fix-bzlib-windows.h-clash.patch - <windows.h> contains a rather ill-advised #define small char, which kills bzlib. bzlib is set up to detect _WIN32 and if so undefine small, but we are undefining _WIN32 to make bzlib work in a more unixy way, so we have to undef small as well. fix-cygwin-mode.patch - The option to compile setup as a Cygwin program was broken. I happened to fix it whilst I was working on gcc3 compilation. (NB: This patch does not include one of the fixes I made: Somehow, the macro min got defined somewhere, even though I #defined NOMINMAX in win32.h. A workaround was to fiddle with the order of includes in site.cc to avoid the error. Since I haven't produced an actual _solution_, I've left this issue unpatched. It's pretty trivial to sidestep until such time I/someone else fixes it properly.) Max.
fix-gcc3-main.patch
Description: Binary data
fix-gcc3-libgetopt++.patch
Description: Binary data
fix-gcc3-dodgy-NULL-streambuf.patch
Description: Binary data
fix-gcc2.patch
Description: Binary data
fix-res.rc-bad-comment.patch
Description: Binary data
fix-bzlib-windows.h-clash.patch
Description: Binary data
fix-CFLAGS+=-Wno-deprecated.patch
Description: Binary data
fix-cygwin-mode.patch
Description: Binary data