1

我有以下代码:

#include <stdio.h>
#include <stdlib.h>
#include <openssl/evp.h>
int main (int argc, char *argv[]) {
    EVP_CIPHER *cipher;
    EVP_idea_ecb();
}

我知道,这并不多,但它应该毫无怨言地编译,但我明白了

gcc Testfile.c -lssl -lcrypto
Testfile.c:(.text+0xec): undefined reference to `EVP_idea_ecb'

gcc Testfile.c -lss
/usr/bin/ld: /tmp/ccgbkhFA.o: undefined reference to symbol 'EVP_CIPHER_iv_length@@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0: error adding symbols: DSO missing from command linel

libssl-dev已安装。任何想法这里出了什么问题?

我的发行版:x64 上的 Debian Jessie。

4

1 回答 1

2

一行一行发生了什么:

gcc Testfile.c -lssl -lcrypto
Testfile.c:(.text+0xec): undefined reference to `EVP_idea_ecb'

Debian Jessie x64 的 OpenSSL 库不包含 EVP_idea_ecb。

gcc Testfile.c -lss
/usr/bin/ld: /tmp/ccgbkhFA.o: undefined reference to symbol 'EVP_CIPHER_iv_length@@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0: error adding symbols: DSO missing from command linel

libss2 命令行界面库包中的 libss.so.2.0 也无济于事。

于 2015-01-13T10:29:39.300 回答