未定义对"SHA1"的引用 [英] Undefined reference to `SHA1'
问题描述
由于Code :: Blocks的问题,我在这里发布
I'm posting here due to a problem with Code::Blocks
我最近在Linux中创建了一个可以正确编译和执行的项目. 现在,我正在尝试使其在Windows上运行.
I've recently created a project in linux which compiled and executed correctly. Now I am trying to made it work on windows.
问题
当我尝试通过Code :: Blocks进行编译时,收到错误消息: C:\ Users \ PC \ Desktop \ Collector \ verification.c | 44 |未定义对"SHA1"的引用|
When I tried to compile thanks to Code::Blocks I received the error : C:\Users\PC\Desktop\Collector\verification.c |44|undefined reference to `SHA1'|
这是我的配置:
- 右键单击我的项目
- 然后选择构建选项"
在链接器设置"中,我有: -lws2_32进入其他链接器选项".
In "Linker setting" i've got : -lws2_32 into the "Other linker options".
在搜索目录"标签中,我得到了:
In the "Search directories" tab i've got :
在编译器"中:
.. \ .. \ .. \ .. \ OpenSSL-Win64 \ include
..\..\..\..\OpenSSL-Win64\include
与我的Open SSL安装的包含文件相对应
which corresponds to my include file of Open SSL install
在链接器中:.. \ .. \ .. \ .. \ OpenSSL-Win64 \ lib
In Linker : ..\..\..\..\OpenSSL-Win64\lib
对应于Open SSL的库
Correspond to lib of Open SSL
这是C语言中出现编译问题的摘录:
And here an extract from the C code who got compilation problem :
bool checkVol(Index* index, unsigned char* vol, int id_vol) {
char outsha[40] = { 0 };
unsigned char outbuf[SHA_DIGEST_LENGTH];
SHA1(vol, sizeof(vol), outbuf);
hexToString(outbuf, outsha);
printf("%s\n", outsha);
printf("%s\n", index->sha[id_vol]);
if ( strcmp(outsha, index->sha[id_vol]) == 0 ) {
printf("Volume %i is the same.\n", id_vol);
return TRUE;
}
return FALSE;
}
我不知道下一步该怎么做才能使我的程序在Windows上运行... 有人知道好的配置吗?
I don't know what should I do next to make my program work on windows... Does someone know the good configuration?
感谢您的帮助.
PS:很抱歉我的英语不好:x
PS : Sorry for my probably bad english :x
推荐答案
我终于设法自己解决了这个问题.
I finally managed to fix this by my own.
修复:
所以首先我删除了x64版本 然后从此链接
So first i've removed the x64 version Then install the "Win32 OpenSSL v1.0.1L" from this link
然后使用以下配置更新我的构建选项:
Then update my build option with the following configuration :
在链接器设置"中,我添加了:
In "linker setting" i've added : the 2 '.a' from
"C:\OpenSSL-Win32\lib\MinGW\"
通过输入来更新搜索目录":
Update "Search directories" by putting :
"C:\OpenSSL-Win32\include"
在编译器"标签中.
希望对其他人有帮助! :D
Hope that's will help other people ! :D
这篇关于未定义对"SHA1"的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!