Include math.h in d3dx9math.inl as it uses sqrt().

Francois Gouget fgouget at
Fri Nov 11 05:45:46 CST 2011

On Thu, 10 Nov 2011, Daniel Scharrer wrote:
> > Does the Microsoft header include math.h?
> I'm sorry, it seems I made a mistake here: the actual header file
> (d3dx9math.h) from wine includes math.h so the sqrt usage is ok.
> However, d3dx9math.inl also uses min and max macros which aren't
> included anywhere. Because of this a winelib user has to
> define/include those symbols before including d3dx9math.h (that was my
> original problem). I'm pretty certain that is not the case for the
> Microsoft headers.
> A quick grep of the wine include files shows that the min/max macros
> are defined in windef.h, minmax.h and msvcrt/stdlib.h - I have no idea
> which one should be included here.

At least up to DirectX 9.0c, d3dx9math.h only includes d3dx9.h and 
math.h (and d3dx9math.inl) so that's what we have to work with. But as 
has been pointed out previously, in DirectX 9.0c d3dx9math.inl does not 
use min() and max(). So removing them from our version is probably the 
right fix.

Francois Gouget <fgouget at>    
       Be careful of reading health books, you might die of a misprint.
                                 -- Mark Twain

More information about the wine-devel mailing list