Undefined link to SSL_library_init and SSL_load_error_strings

I am implementing OpenSSL code and have already included the necessary header files, but still I get errors like *

undefined link to SSL_library_init

I assume this is a communication error, not a compilation error.

I use it in a Linux window using slickeditor.

+5
source share
2 answers

Link to libssland libcrypto. Yours LDFLAGSand LDLIBSwill look as follows. Questions for ordering LDLIBS:

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

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

, . , .

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

OpenSSL, -L/usr/local/ssl/lib.

+8

ldd libssl.so → libcrypto.so.1.1 = >

sudo ln -s/usr/local/lib64/libcrypto.so.1.1/usr/lib64/libcrypto.so.1.1

libcrypto.so.1.1 = > /lib64/libcrypto.so.1.1 (0x00007f17d46c7000)

0

All Articles