Game Development Community

MD5 Resource wont compile anymore

by Adam Beer · in Torque 3D Professional · 09/30/2010 (7:25 pm) · 4 replies

I am trying to get this resource into beta 2/3 of T3D and it's not compiling anymore:

www.torquepowered.com/community/resources/view/4392

I get some link errors that I never used to get in previous T3D versions. Any idea what changed and how I can fix the link errors?

#1
09/30/2010 (7:45 pm)
Try this, remove the other md5console file from your project and

At the top of md5.cpp
#include "console/engineAPI.h"
#include "console/consoleTypes.h"

At the bottom of md5.cpp
DefineConsoleFunction( getStringMD5, const char *, (const char *What),, "")
{
   MD5_CTX context;
   U8 digest[16];
   
   static U8 digestB16[128];
 
   U32 len = dStrlen (What);

   MD5Init (context);
   MD5Update (context, (U8 *) What, len);
   MD5Final (digest, context);
   
   for (U32 Index = 0; Index < 16; Index++)
   {
      U32 Byte1 = Index * 2;
      U32 Byte2 = Byte1 + 1;
      
      U8  Value1 = (digest[Index] & 0xF0) >> 4;
      U8  Value2 = digest[Index] & 0x0F;
      
      digestB16[Byte1] = Base16Values[Value1];
      digestB16[Byte2] = Base16Values[Value2];
   }
  
   digestB16[32] = 0;

   char *ret = Con::getReturnBuffer(32);
   dStrcpy(ret, digestB16);
   return ret;
}
#2
09/30/2010 (7:53 pm)
Doesnt seem to like it:

1>md5console.cc
1>..\..\..\..\..\Engine\source\app\md5console.cc(56) : error C2065: 'getStringMD5' : undeclared identifier
1>..\..\..\..\..\Engine\source\app\md5console.cc(56) : error C2059: syntax error : 'const'
1>..\..\..\..\..\Engine\source\app\md5console.cc(57) : error C2143: syntax error : missing ';' before '{'
1>..\..\..\..\..\Engine\source\app\md5console.cc(57) : error C2447: '{' : missing function header (old-style formal list?)

I am not familiar with the new DefineConsoleXXX functions yet so sorry if its something obvious.
#3
09/30/2010 (7:56 pm)
Ok, I noticed you edited your post, and what you updated it with works. Thanks!
#4
09/30/2010 (8:09 pm)
Spoke too soon, it complies but its saying "Unable to find function getStringMD5". I did a full recompile so I dont know how it cant find the function?