On Tue, Dec 15, 2020 at 12:02 PM Eli Zaretskii <eliz****@gnu*****> wrote: > > When I use MinGW GCC 4.7.2 from that era the program links and runs > > fine. > > > > When I try to use MinGW GCC 9.2.0 I get 'undefined reference' while > > linking to an external library, that links just fine with 4.7.2. > Are you using the same version of MinGW runtime and w32api headers, or > is each compiler version being used with different runtime and API > versions? Each compiler matched its respective headers and runtime I was not intermixing things, knowing what a mess that turns out to be. I found the problem was that the compiler from 2012 was 32 bits and the one from 2019 was 64 bits. Linking to wsc64.lib instead of wsc32.lib solved the problem. However I find this error message completely misleading: > > (.text+0xf0): undefined reference to `__imp_SioInfo' > > Is SioInfo your function or something you expect to find in a library? SioInfo() is in the wsc library. The wsc API calls it SioInfo() and I call it as such, yet the compiler complains, rather than giving anything remotely useful as to the real problem. Any way to get a more useful error message such as 'trying to link a 32 bit library with a 64 bit compiler'?