Link to home
Start Free TrialLog in
Avatar of Confettis
Confettis

asked on

LOTS of errors while trying to compile md5 code from site

Hello.
I tried to compile the code from http://www.faqs.org/rfcs/rfc1321.html which should calculate an md5 from a string.
I got the following errors:
*******
Compiling...
md5c.c
test_md5.c
test_md5.c(106) : error C2065: 'MD_CTX' : undeclared identifier
test_md5.c(106) : error C2146: syntax error : missing ';' before identifier 'context'
test_md5.c(106) : error C2065: 'context' : undeclared identifier
test_md5.c(107) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(108) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(110) : warning C4013: 'MDInit' undefined; assuming extern returning int
test_md5.c(111) : warning C4013: 'MDUpdate' undefined; assuming extern returning int
test_md5.c(111) : error C2065: 'len' : undeclared identifier
test_md5.c(112) : warning C4013: 'MDFinal' undefined; assuming extern returning int
test_md5.c(112) : error C2065: 'digest' : undeclared identifier
test_md5.c(114) : error C2065: 'MD5' : undeclared identifier
test_md5.c(124) : error C2146: syntax error : missing ';' before identifier 'context'
test_md5.c(125) : error C2275: 'time_t' : illegal use of this type as an expression
        c:\program files\microsoft visual studio\vc98\include\time.h(79) : see declaration of 'time_t'
test_md5.c(125) : error C2146: syntax error : missing ';' before identifier 'endTime'
test_md5.c(125) : error C2065: 'endTime' : undeclared identifier
test_md5.c(125) : error C2065: 'startTime' : undeclared identifier
test_md5.c(126) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(127) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(134) : error C2065: 'i' : undeclared identifier
test_md5.c(135) : error C2065: 'block' : undeclared identifier
test_md5.c(135) : error C2109: subscript requires array or pointer type
test_md5.c(135) : error C2106: '=' : left operand must be l-value
test_md5.c(183) : error C2146: syntax error : missing ';' before identifier 'context'
test_md5.c(184) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(185) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(192) : error C2065: 'buffer' : undeclared identifier
test_md5.c(192) : warning C4022: 'fread' : pointer mismatch for actual parameter 1
test_md5.c(208) : error C2146: syntax error : missing ';' before identifier 'context'
test_md5.c(209) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(210) : error C2143: syntax error : missing ';' before 'type'
test_md5.c(213) : warning C4022: 'fread' : pointer mismatch for actual parameter 1
Error executing cl.exe.
*********
I copied and pasted the code directly, so I don't know what I'm doing wrong....

(PS.: is there also an option to tell the compiler explicitly to compile the files as C and not as C++ , or should I just give the files a C-extention in stead of .cpp ??)
Avatar of sunnycoder
sunnycoder
Flag of India image

Are you sure you have the files copied properly and you are not mixing some of the code around ....

I see MD_CTX defined there
SOLUTION
Avatar of aib_42
aib_42

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Confettis
Confettis

ASKER

Hi, and thanks for your replies.

sunnycoder, yes I am sure that that's not the error, I checked it several times....
aib_42, no, I don't have changed this part, neither have I more than one file with the same name .....

Did one of you tried to compile the files ??? (and, if so, did you had errors ??)
The include path needs to be supplied to the compiler.  This is usually in the form of "-I<filename>" on the command line.
I see you have renamed md5.c to test_md5.c. If this is the case for other files too, you would have to modify the #include lines all over the source code.
Thanks,
teratoma, I did this (I'm using Visual studio)
aib_42, It's not the "md5c.c" I renamed but the "MDDRIVER.C", which was a "sample testing program"

I'm starting to get desperate....
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks teratoma; this was indeed correct. It is working now.