当链接到OpenSSL库时,我得到了以下错误:
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info):
relocation 6 has invalid symbol index 13我一直在努力寻找解决方案。我想要散列,我需要调用哪些函数,以及字符串散列后在哪里找到它。我对代码中的内容感到困惑。
#include <stdio.h>
#include <string.h>
#include <openssl/crypto.h>
#include <openssl/sha.h>
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
{
SHA_CTX c;
static unsigned char m[SHA_DIGEST_LENGTH];
if (md == NULL)
md = m;
if (!SHA1_Init(&c))
return NULL;
SHA1_Update(&c, d, n);
SHA1_Final(md, &c);
OPENSSL_cleanse(&c, sizeof(c));
return (md);
}发布于 2015-08-12 17:21:40
编译时可能缺少-c命令,如下所示:
g++ -c ......或者可能是因为缺少main()函数。
https://stackoverflow.com/questions/30883113
复制相似问题