未定义对SSL_library_init和SSL_load_error_strings的引用 [英] Undefined reference to SSL_library_init and SSL_load_error_strings

查看:2333
本文介绍了未定义对SSL_library_init和SSL_load_error_strings的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现OpenSSL代码,并且已经包含必需的头文件,但是仍然出现类似*

I am implementing a OpenSSL code and have already included required header files but still I am getting errors like *

SSL_library_init的未定义引用

我想这是链接错误,而不是编译错误.

I guess it's a linking error rather than a compilation error.

我正在使用slickeditor在Linux框中实现它.

I am implementing it in Linux box using slickeditor.

推荐答案

链接到libssllibcrypto.您的LDFLAGSLDLIBS将如下所示. LDLIBS的订单事项:

Link against libssl and libcrypto. Your LDFLAGS and LDLIBS would be as follows. Order matters for LDLIBS:

LDFLAGS = -L/usr/local/ssl/lib
LDLIBS = -lssl -lcrypto

不用担心在库名之前添加"lib",或者后缀"so"或"a".链接器将为您完成此操作.

Don't worry about adding the "lib" in front of library name, or the "so" or "a" suffix. The linker will do it for you.

如果从命令行构建,则将使用以下内容.同样,顺序很重要.

If you are building from the command line, then you would use the following. Again, order matters.

gcc foo.c -o foo.exe -L/usr/local/ssl/lib -lssl -lcrypto

如果使用系统的OpenSSL,则可以省略-L/usr/local/ssl/lib.

If you are using the system's OpenSSL, then you can omit -L/usr/local/ssl/lib.

这篇关于未定义对SSL_library_init和SSL_load_error_strings的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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