Linking *.lib files with MinGW

試著忘記壹切 提交于 2019-12-18 12:49:31

问题


Is it possible to Link *.lib files with MinGW(I use it with Eclipse) unambiguous information about that. I'm fighting with libcurl+OpenSSL so now I don't understand if my errors are because I try to use .lib-files in MinGW or something else is wrong


回答1:


Probably not. mingw's static library format is *.a.

Dynamic libraries for a given platform are standardized by the OS loader that must be able to load them.

Static libraries only have to be understood by the toolchain's linker, and are thus less cross compiler compatible. Afaik *.lib files are not even compatible across all MSVC versions.

Added later due to pestering comments: Newer versions of mingw also support .lib files, but you asked your question back in '11, and then you probably wouldn't have them then.




回答2:


mingw also accepts libraries with a .lib extension.

For instance, a library named libsample.lib must be linked as

-L -llibsample

Reference: http://www.mingw.org/wiki/Specify_the_libraries_for_the_linker_to_use




回答3:


New mingw versions support linking lib files. But I faced issues where .lib is with prefix libxxxx.lib.It ommits the preffix lib in linking. So make it like lib<name>.lib

Also there are ways to convert a .lib to .a ex: lib2a You can use that as well.



来源:https://stackoverflow.com/questions/7241047/linking-lib-files-with-mingw

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!