我只是在试用NaCl网站上的Xsalsa20代码。我无法编译它。
#include "build/BlackDragon/include/x86/crypto_stream.h"
#include<stdio.h>
int main(){
//const unsigned char m[crypto_stream_xsalsa20;
const unsigned char k[crypto_stream_xsalsa20_KEYBYTES] = "1234567890123456789012345678901";
const unsigned char n[crypto_stream_xsalsa20_NONCEBYTES] = "12345678901234567890123";
unsigned char c[51];
unsigned long long len;
len = 50;
crypto_stream_xsalsa20(c,len,n,k);
//printf("%s",m);
return 0;
}当我尝试用GCC编译这段代码时,我得到了以下错误消息。
/tmp/ccNaI8Z1.o: In function `main':
Test.cpp:(.text+0xbc): undefined reference to `crypto_stream_xsalsa20_ref'
/tmp/ccNaI8Z1.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
collect2:error: ld returned 1 exit status有人能帮我解决这个问题吗。
PS:这段代码在我编译NaCl的NaCl文件夹中
发布于 2014-08-19 15:41:07
我通过将库安装到系统路径中解决了这个问题。为了方便起见,您可以使用
apt-get install libnacl-devhttps://stackoverflow.com/questions/25370664
复制相似问题