First, it is possible that library headers simply do not represent their dependencies properly. Try adding #include <cstdio> and possibly (unfortunately) a using namespace std; to your file at the top.
Otherwise, a few people have problems with MinGW and swprintf. This mailing list suggests adding the following:
#ifdef WIN32 #define swprintf _snwprintf #endif
See if this fixes the problem. (You also want it at the very top of the file.)
If adding random definitions to your source seems like a bad idea, I suggest using the -D build flags to conditionally enter the above definition when you build on MinGW.
See also this short discussion about the differences between swprintf on MinGW and other compilers.
Finally, otherwise, this link seems to attribute the problem to the problem with flags that allow __STRICT_ANSI__ in MinGW, and suggests commenting out a couple of lines in one of the MinGW headers to fix this problem. I would suggest adding a simpler #ifndef __STRICT_ANSI__ , if you decide to go with this hack.
Walter Mundt Feb 15 '11 at 12:46 2011-02-15 12:46
source share