C99: md5

I don't understand why this doesn't compile
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/types.h>
#include <md5.h>

int main(int argc, char **argv) {
	MD5_CTX md5;
	MD5Init(&md5);

	char test[]="test";
	MD5Update(&md5, test, strlen(test));

	char *res = MD5End(&md5, NULL);

	printf("%s\n", res);

	free(res);
	return 0;
}

Code:
killasmurf86 $ make
cc -O2 -pipe -march=pentiumpro -Wall -std=c99 -g passwd.c -o test
/var/tmp//ccKahwVY.o(.text+0x23): In function `main':
/home/killasmurf86/src/c/sd_prog/src/passwd.c:12: undefined reference to `MD5Init'
/var/tmp//ccKahwVY.o(.text+0x4d):/home/killasmurf86/src/c/sd_prog/src/passwd.c:15: undefined reference to `MD5Update'
/var/tmp//ccKahwVY.o(.text+0x5b):/home/killasmurf86/src/c/sd_prog/src/passwd.c:17: undefined reference to `MD5End'
*** Error code 1

Stop in /home/killasmurf86/src/c/sd_prog/src.
I just don't get it, I included md5.h and sys/types.h, why i see this ^^^
 
aaaaaaaaaaaaa, that was so easy....
One thing I don't understand, hod you you figure out name of library you need to link with, if header name is different.... this is big booger to me

For example you inlcude <libpq-fe.h> (PostgreSQL) and link against pq
Why suck a cryptology?

man also doesn't say, against shich lib I need to link... it might as well be md5
 
That one was from manpage :) :
Code:
NAME
     MD5Init, MD5Update, MD5Pad, MD5Final, MD5End, MD5File, MD5FileChunk,
     MD5Data — calculate the RSA Data Security, Inc., ‘‘MD5’’ message digest

[B]LIBRARY
     Message Digest (MD4, MD5, etc.) Support Library (libmd, -lmd)[/B]
 
crsd said:
That one was from manpage :) :
Code:
NAME
     MD5Init, MD5Update, MD5Pad, MD5Final, MD5End, MD5File, MD5FileChunk,
     MD5Data — calculate the RSA Data Security, Inc., ‘‘MD5’’ message digest

[B]LIBRARY
     Message Digest (MD4, MD5, etc.) Support Library (libmd, -lmd)[/B]

Holy shit. It was right on top of manpage..... how the hell did I miss it. lol
Thank you very much, I owe you a beer
 
Back
Top