Heya Wim,

>> It is very annoying that windows.h breaks so much. Therefore, if
>> possible, we avoid to include windows.h as side-effect of including a
>> wt header file. That you run into these problems means that windows.h
>> is included before you include Wt header files.

I`m actually making a clean Wt build. That is, downloaded Wt 3.1.0, OpenSSL,
libGD and zLib, used CMake to create the project files and compiled the
solution. In no moment I have changed any of Wt`s source code and included
windows headers myself. I`m using Microsoft Visual Studio 2008, compiler and
IDE info below:

Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5 SP1
Installed Edition: Enterprise
Microsoft Visual C++ 2008   91899-270-3300834-60102

>> Unfortunately, we have to live with the situation as it is, and I'm
>> happy to follow your suggestion to rewrite our code to be more
>> windows.h-friendly.
>> I changed WAxis like this:
>> void setRange(double min, double max);
>> void setRange(double minimum, double maximum);
>>
>> But I could not find occurences of min or max in the other header
>> files that you mention?


To be more especific about the error, one of the many errors related to this
issue occurs at WAxis.C:79-80, code:

maximum_ = std::max(y, maximum_);
minimum_ = std::min(y, minimum_);

There is a conflict between std::max/min and Windows`s max/min macros (in
WinDef.h). This conflict is resolved by changing those lines (and all the
other occurrences) to:

maximum_ = (std::max)(y, maximum_);
minimum_ = (std::min)(y, minimum_);

I understand that windows.h should not be mixed with Wt`s includes. Maybe
its an alien include somewhere? I`ll try to find where WinDef.h is being
included in Wt`s code.

Cya,
Daniel.


On Thu, Jan 28, 2010 at 7:29 PM, Daniel Cavalcanti
<necr0pote...@gmail.com>wrote:

> Hi everyone,
>
> WAxis, WChart2DRenderer and WStandardItem use std::max/std::min. There are
> many other files as well but I didn`t list them all. When compiling under
> Windows there is a conflict with the declarations contained in WinDef.h.
>
> Long story short, the explanation is here:
> http://heifner.blogspot.com/2008/02/stdmin-and-stdmax.html
>
> Recommended approach:
> replace all std::max and std::min for (std::max) and (std::min). I find
> this approach cleaner than using #define NOMINMAX.
>
> Cya,
> Daniel.
>



-- 
"Rule of Extensibility: Design for the future, because it will be here
sooner than you think."
                                 -The Art of Unix Programming
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to