this is very confusing. I spent a lot of time reading posts on this on stack, etc. Still confused.
I am using Qt and C++ for coding. In Qt, I am using the gcc optio
Maybe it is worth starting at the beginning and not jump ahead of ourselves and describe the core issue. From this answers to several of the questions can be derived.
The start is the ABI (application binary interface). This defines things like
Most platforms define a C ABI but don't define a C++ ABI. As a result compiler define their own ABI (for everything except the C stuff which is typically there). This yields object files which are incompatible between different compilers (sometimes even between versions of the same compiler).
Typically, this manifests itself in strange-looking names somehow being undefined: different ABIs deliberately use different name mangling to prevent accidentally linking an executable which won't work anyway. To work around these your best bet is to build all components using the same compiler.
If you want to determine which compiler a library is build with, you can have a look at its contents using appropriate tools. I realize that you asked for Windows but I only know the UNIX tools (they may be available with MingW):
Looking at the symbols typically yields identifications of what compiler produced them. If you have seen them suffiently often, you can even tell the ABI from the symbols themselves.
There is lots more in this area but I've run out of stamina... :-) In any case, I think this answers several of the questions above.