我在安装页面阅读了Compilation on Windows的部分,但我仍然很困惑,希望高手能赐教。
我LATEST.tar.gz
从这里下载。
之后,我复制sodium.h
并sodium
文件夹libsodium-1.0.12\src\libsodium\include
到我的项目中。
这是代码:
#include <stdio.h>
#include "sodium.h"
#pragma warning (disable:4996)
void main()
{
char myString[32];
uint32_t myInt;
/* myString will be an array of 32 random bytes, not null-terminated */
randombytes_buf(myString, 32);
/* myInt will be a random number between 0 and 9 */
myInt = randombytes_uniform(10);
printf("%d", myInt);
system("pause");
}
编译时出现这些错误:
错误 LNK1120 2 未解决的外部
函数 _main 中引用的错误 LNK2019 未解析的外部符号 __imp__randombytes_buf
函数 _main 中引用的错误 LNK2019 未解析的外部符号 __imp__randombytes_uniform
我没有收到像“无法打开 sodium.h”这样的错误。
我该如何解决这个问题?
任何帮助表示赞赏。