在Linux中,如何判断我是链接到静态库还是动态库? [英] In linux how can I tell if I'm linking to a static or dynamic library?

查看:54
本文介绍了在Linux中,如何判断我是链接到静态库还是动态库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个同名的静态和动态库:libclsocket.a和libclsocket.so当我指定要链接的库时,只需输入-lclsocket作为库.我的程序可以正常运行,但是我使用的是哪个库?静态库还是动态库?我想给我的朋友我的程序,并且我不确定是否需要在发行版中包含这些库.C ++,Codelite,pcLinuxOS 2010

I have a static and a dynamic library with the same name: libclsocket.a and libclsocket.so When I specify what library I want to link to i simply enter -lclsocket as the library. My program complies and runs perfectly fine, but what library am I using? the static library or the dynamic library? I want to give my friend my program, and I'm not sure If i need to include the libraries in the release. C++, codelite, pcLinuxOS 2010

推荐答案

您可以尝试在可执行文件上运行 ldd ,并查看是否在依赖项列表中按要求检测到附带的.so.

You can try running ldd on the executable and seeing if the accompanying .so is being detected as required in the list of dependencies.

ldd手册页位于此处.

这篇关于在Linux中,如何判断我是链接到静态库还是动态库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆