【问题标题】:Failed to link program with OpenSSL无法将程序与 OpenSSL 链接
【发布时间】:2015-12-15 06:15:13
【问题描述】:

这是我的编译命令

gcc msg_utils.o -o mtm -lm -L/openssl-1.0.0a  -lssl -lcrypto

我得到错误:

/usr/bin/ld: cannot find -lssl

请告诉我我的命令有什么问题,openssl 的路径是正确的,我从以下位置获取 openssl 源代码:

https://www.openssl.org/source/openssl-1.0.0a.tar.gz

【问题讨论】:

标签: gcc linker openssl


【解决方案1】:

(我猜你是在 Linux 上)

您可能应该在您的 Linux 发行版中安装一些 OpenSSL 包。

也许aptitude install libssl-dev 在 Debian 相关发行版上。

如果您从源代码编译 OpenSSL,您可能需要一些 make install 步骤,然后您可能需要运行 ldconfig

您可能希望在编译代码期间使用pkg-config

gcc -Wall -g $(pkg-config -cflags openssl) \
   msg_utils.o -o mtm \
   $(pkg-config -libs openssl)

另见thisthat

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-24
    • 2019-02-18
    • 2017-11-25
    • 1970-01-01
    • 1970-01-01
    • 2012-06-15
    相关资源
    最近更新 更多