GCC中的OpenSSL链接选项-lssl和-lcrypto

Mat*_*son 9 linker gcc openssl

添加链接选项后:-lssl和-lcrypto,我的程序被正确编译.但是,我发现GCC不包括这两个选项,那么选项来自哪里?

ind*_*div 11

海湾合作委员会的文件告诉我们,-l是一个库链接的选项.

-llibrary
-l library
Search the library named library when linking. (The second alternative with the
library as a separate argument is only for POSIX compliance and is not
recommended.)
Run Code Online (Sandbox Code Playgroud)

所以你告诉gcc链接库"ssl"和"crypto".这些库通常安装在/usr/lib.在Linux上,他们将被称为libssl.solibcrypto.so.在OS X上,他们将被调用libssl.dyliblibcrypto.dylib.