How do I compile the example on mingw-w64?

I think you need to check that your install of MinGW is searching it’s own include path. To do that see their guide:

http://www.mingw.org/wiki/IncludePathHOWTO