On Thu, April 13, 2006 04:07, Bart Samwel wrote: > Roman Shchugarev wrote:
>> Got myself in to trouble once again, it is said in libq header that to >> use libpqxx I >> need to define NOMINMAX option, but in that case I am unable to use >> #include < >> afxtempl.h> (Using MS VisualStudio .NET2k3). > I can suggest two possible solutions: > > 1. Include afxtempl.h and all other system headers that require FIRST, > then: > > #undef min > #undef max > > and only then include libpqxx. > > 2. Include *all* that you need of libpqxx before including *any* Windows > or MFC headers. Then NOMINMAX is not needed, as libpqxx will not be > included with min and max defined. I think NOMINMAX will still be defined in there somewhere, so you may need to #undef it after including the libpqxx headers. I'm really sorry to cause this trouble; normally I try to keep libpqxx as inobtrusive as possible w.r.t. your compilation environment. Unfortunately the min/max macros in this compiler caused so much unreasonable trouble (not just with libpqxx but with the standard library itself, as well as with other perfectly straightforward standard-compliant code!) that in the end we saw no other practical choice than to define NOMINMAX. Now, there's one thing here that makes me curious: this is the first time I've ever heard of these macros ever being _needed_ for anything. First time in fact I heard of even a theoretical possibility of them making any difference at all (apart from breaking things, of course). Practically all code I can think of should just work as normal if one replaced the macros with the standard functions, and a lot of proper code would suddenly start working. So does afxtempl.h explicitly check for the presence of min() and max() macros, and refuse to work if they're not there? If so, why? If not, what goes wrong if they're not there? Jeroen _______________________________________________ Libpqxx-general mailing list Libpqxx-general@gborg.postgresql.org http://gborg.postgresql.org/mailman/listinfo/libpqxx-general