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

14,139

Solution 1

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

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

Solution 2

.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
Share:
14,139
chacham15
Author by

chacham15

Updated on July 03, 2022

Comments

  • chacham15
    chacham15 almost 2 years

    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: Warning: .drectve /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized.

    Also a few errors including: ./libetpan.a(Release_ssl/mailimap.obj):(.text[_mailimap_noop]+0x7): undefined reference to___security_cookie'`.

    Any help is greatly appreciated.