未定义的openssl函数引用

时间:2016-11-19 12:10:16

标签: c++ unix makefile compilation openssl

在Ubuntu 14.04中我有:

生成文件:

CC = g++

all: imapcl 

imapcl: imapcl.o
    $(CC) -o imapcl imapcl.o

clean:
    rm -rf *o imapcl.o imapcl.exe imapcl 

和这个简单的测试文件imapcl.cpp

// OpenSSL headers
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"

int main ()
{    
    /* Initializing OpenSSL */       
    SSL_load_error_strings();
    ERR_load_BIO_strings();
    OpenSSL_add_all_algorithms();
}

编译时我收到此错误:

imapcl.cpp:(.text+0x2607): undefined reference to `SSL_load_error_strings'
imapcl.cpp:(.text+0x260c): undefined reference to `ERR_load_BIO_strings'
imapcl.cpp:(.text+0x2611): undefined reference to `OPENSSL_add_all_algorithms_noconf'
collect2: error: ld returned 1 exit status

0 个答案:

没有答案