使用 MinGW 链接 *.lib 文件 [英] Linking *.lib files with MinGW
问题描述
是否可以将 *.lib
文件与 MinGW 链接(我在 Eclipse 中使用它)?
Is it possible to Link *.lib
files with MinGW (I use it with Eclipse)?
我正在使用 libcurl+OpenSSL,但我不明白我的错误是因为我尝试在 MinGW 中使用 .lib
-files 还是其他错误:
I'm fighting with libcurl+OpenSSL and I don't understand if my errors are because I try to use .lib
-files in MinGW or something else is wrong:
..lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0x6): undefined reference to `_chkstk'
..lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0xb): undefined reference to `__security_cookie'
..lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0x63): undefined reference to `@__security_check_cookie@4'
..lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0x19e): undefined reference to `@__security_check_cookie@4'
..lib/libeay32.lib(tmp32/ech_ossl.obj):(.text[_ecdh_compute_key]+0x6): undefined reference to `_chkstk'
..lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_asn1_bio_set_ex]+0x6): undefined reference to `_chkstk'
..lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_asn1_bio_get_ex]+0x6): undefined reference to `_chkstk'
..lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_BIO_asn1_set_prefix]+0x6): undefined reference to `_chkstk'
..lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_BIO_asn1_get_prefix]+0x6): undefined reference to `_chkstk'
..lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_BIO_asn1_set_suffix]+0x6): more undefined references to `_chkstk' follow
..lib/ssleay32.lib(tmp32/ssl_lib.obj):(.text[_SSL_has_matching_session_id]+0xb): undefined reference to `__security_cookie'
推荐答案
可能不会.mingw的静态库格式是*.a.
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.
静态库只需要被工具链的链接器理解,因此不太兼容交叉编译器.Afaik *.lib 文件甚至不兼容所有 MSVC 版本.
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.
后来添加,因为评论很麻烦:较新版本的 mingw 也支持 .lib 文件,但你在 11 年问过你的问题,那时你可能不会有它们.
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.
这篇关于使用 MinGW 链接 *.lib 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!