我有一个非常简单的代码:
#include <openssl/sha.h>
int main() {
SHA_CTX sha1;
SHA_Init(&sha1);
}
我已经安装了libssl-dev
和libcrypto++-dev
:
但是,我使用以下命令构建失败:
$ gcc -lcrypto -lssl main.c
/tmp/ccfnCAxT.o: In function `main':
main.c:(.text+0x1f): undefined reference to `SHA1_Init'
collect2: error: ld returned 1 exit status
$
$ gcc -lssl main.c
/tmp/ccfnCAxT.o: In function `main':
main.c:(.text+0x1f): undefined reference to `SHA1_Init'
collect2: error: ld returned 1 exit status
平台:Ubuntu 16.04