我試圖用openssl-references編譯一個c程序。我正在使用Linux Mint 17.1,並安裝了開發包「libssl-dev」。鏈接OpenSSL時沒有引用BIO函數
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
...
void send_smtp_request(BIO *bio, const char *req)
{
BIO_puts(bio, req);
BIO_flush(bio);
printf("%s", req);
}
如果我編譯代碼:
gcc -o client bio-ssl-smtpcli2.c
我得到這個錯誤:
/tmp/ccCHrti2.o: In function 'send_smtp_request':
bio-ssl-smtpcli2.c:(.text+0x1f): undefined reference to 'BIO_puts'
bio-ssl-smtpcli2.c:(.text+0x3a): undefined reference to 'BIO_ctrl'
有人有一個想法如何解決這一問題?
[現有C項目中OpenSSL庫的鏈接問題]的可能副本(http://stackoverflow.com/questions/5700617/linking-problem-of-openssl-library-in-existing-c-project),[在GCC中鏈接OpenSSL libcrypto](http://stackoverflow.com/q/18835219),[引用一堆尚未解決的OpenSSL符號的錯誤清楚地存在?](http://stackoverflow.com/q/15318978), ... – jww