Reputation: 855
I'm posting here due to a problem with Code::Blocks
I've recently created a project in linux which compiled and executed correctly. Now I am trying to made it work on windows.
Problem
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'|
Here is my configuration :
In "Linker setting" i've got : -lws2_32 into the "Other linker options".
In the "Search directories" tab i've got :
In "Compiler" :
..\..\..\..\OpenSSL-Win64\include
which corresponds to my include file of Open SSL install
In Linker : ..\..\..\..\OpenSSL-Win64\lib
Correspond to lib of Open SSL
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;
}
I don't know what should I do next to make my program work on windows... Does someone know the good configuration?
Thanks for your help.
PS : Sorry for my probably bad english :x
Upvotes: 0
Views: 1881
Reputation: 855
I finally managed to fix this by my own.
Fix :
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"
in "Compiler" tab.
Hope that's will help other people ! :D
Upvotes: 2