How to use libraries compiled with MingW in MSVC?

Posted by NumberFour on Stack Overflow See other posts from Stack Overflow or by NumberFour
Published on 2010-03-27T15:11:58Z Indexed on 2010/03/27 15:13 UTC
Read the original article Hit count: 288

Hello,

I have compiled several libraries with MingW/MSYS... the generated static libraries are always .a files. When I try to link the library with a MSVC project, Visual Studio throws 'unresolved external symbols' ... It means that the .a static library is incompatible with MS C++ Linker. I presume it has to be converted to a MSVC compatible .lib file.

Either .a and .lib are just AR archives of .o or .obj files, so is there any way how to use MingW compiled libs in a MSVC project? Or do I have to compile/link everything just in one compiler/linker - MSVC only/MingW only? The MingW compiler is said to be compatible with MSVC.

I read a few threads about this topic, but they mostly say that renaming the file to .lib should do the work, but it unfortunately doesn't work for me.

Thanks for any advice.

© Stack Overflow or respective owner

Related posts about mingw

Related posts about c++