Without having gone into any greater degree of detail, I would assume it's because MinGW can't find the DX9 SDK includes.
Does MinGW compile them? You wheren't very specific about how "it compiles in C++".
Does MinGW compile them? You wheren't very specific about how "it compiles in C++".