vendredi 27 février 2015

Undefined reference to `SHA1'

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 :



  • Right click on my project

  • Then "Build options"


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


Aucun commentaire:

Enregistrer un commentaire