gcc -l 选项和 .la 库文件
您能否解释一下,如何使用 -l 选项链接 .la 文件?
就我的经验而言 - 我只链接了静态库(.a)文件。
现在我查看了一些 Qt 生成的 Makefile,但无法弄清楚,当指定 -l QtCore 开关时,链接器如何计算出使用/打开 libQtCore.la 文件,而不是寻找 libQtCore.a。
另外 - gcc 手册指出,-l[库名称] 开关将包含 lib[库名称].a,而不是 lib[库名称].la。
Could you please explain, how linking with -l option against .la files works?
As far as my experience reaches - i have only linked against static library (.a) files.
Now i took a look at some Qt generated Makefiles and cant figure out, how linker figures out to use/open libQtCore.la file, when -l QtCore switch is specified, instead of looking for libQtCore.a.
Also - gcc manual states, that -l[library name] switch will include lib[library name].a, not lib[libraryname].la.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,
.la
文件是 libtool 垃圾,不应手动链接。无论出于何种原因,libtool 都会在内部使用它们。您应该链接到*.a
文件。在 Qt 安装/构建中应该有*.a
文件要链接到。.la
files are as far as I know libtool junk and shouldn't be linked to manually. They are used internally by libtool for whatever reason it needs them. You should link to the*.a
file. In a Qt install/build there should be*.a
files to link to.