Undefined link to md5

#include <openssl/md5.h>
void mMD5(unsigned char * packet, int size) {

    unsigned char* res;

    MD5((unsigned char*)&packet, size, (unsigned char*)&res);

    for(int i=0; i<MD5_DIGEST_LENGTH; i++) {
        printf("%02x", res[i]);
    }
}

I get an error: undefined link to MD5

Can anybody help me?

+5
source share
1 answer

You need to set the link to the appropriate library. You should have a file with a name md5.libor md5.aor something like that (depending on your OS) and add it to your linker command line (again, depending on your environment).

+9
source

All Articles