2015-12-15 73 views
0

鏈接程序這是我的編譯命令無法與OpenSSL的

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

+0

哪些操作系統? –

+0

[將OpenSSL庫鏈接到程序]的可能重複(http://stackoverflow.com/questions/4352573/linking-openssl-libraries-to-a-program)。同時確保您使用'shared'選項進行配置;請參閱[編譯和安裝|在OpenSSL wiki上配置選項](https://wiki.openssl.org/index.php/Compilation_and_Installation)。 – jww

回答

0

(我想你在Linux上)

你應該可能安裝你的Linux發行版中的一些OpenSSL包。

或許aptitude install libssl-dev與Debian相關的分佈情況。

如果您從源代碼編譯OpenSSL,則可能需要一些步驟,然後您可能需要在此之後運行ldconfig

您可能希望你的代碼編譯期間使用pkg-config

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

又見thisthat