How can I convert a VSTS .lib to a MinGW .a?

后端 未结 2 1959
粉色の甜心
粉色の甜心 2021-01-12 19:07

I have a static library compiled with Visual Studio and I want to link to it from MinGW.

I tried changing the suffix but I get a bunch of warnings like: Warni

相关标签:
2条回答
  • 2021-01-12 19:21

    .lib and .a are not the same format. Changing the file extension is lying to the linker, which is why it isn't working.

    If it is a 32-bit library you are trying to link, it should "just work." MinGW supports 32-bit .lib files. If it doesn't, file a bug report.

    If it is a 64-bit library, and you are using MinGW-w64 or something based on it (like the TDM-GCC 64-bit version) see the MinGW-w64 FAQ entry:

    gendef mylib.dll
    dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libmylib.a --input-def mylib.def
    
    0 讨论(0)
  • 2021-01-12 19:37

    You can try to convert the .lib to .a with

    http://code.google.com/p/lib2a/

    0 讨论(0)
提交回复
热议问题