From MinGW static library (.a) to Visual Studio static library (.lib)

The archives of static libraries generated with MinGW are generally compatible with Visual C++ compiler/linker. So, you should be able to use them directly by adding .a files to linker input in your project properties in Visual Studio:

  1. Go to project Properties (Alt-F7).
  2. On the left box, open Configuration Properties->Linker->Input
  3. Add list of all .a archives you need to use
  4. You may need to add also MinGW’s libgcc.a library

Also, there may occur problems regarding mixed C run-time libraries properties of C/C++->Code Generation->Runtime Library, but this depends on your build configuration you use with MinGW. Sometimes it is necessary to link against libmsvcrt.a from MinGW but in many (if not most) cases it causes problems.

Finally, this mixed MinGW and Visual C++ linking generally works but for C modules and it does not work for C++, as far as I know.

Leave a Comment