Code:
std::string getMD5(std::string pass)
{
MD5_CTX mdCntxt;
MD5Init(&mdCntxt);
char digest[32];
MD5Update(&mdCntxt, pass.c_str(), pass.size());
MD5Final(&mdCntxt);
for (int i = 0; i < 16; i++)
sprintf(digest, "%s%02x", digest, mdCntxt.digest[i]);
return std::string(digest);
}
--
das wird wohl irgendein Problem mit dem Header sein, weil da einfach
steht, und das versteht g++ wohl nicht.
ich werd mal versuchen den Header zu korrigieren.
Edit: Das wars Aber jetzt kommt was anderes :/
Code:
giuly@Campi64 ~/ajccc/ajccc $ make
g++ -c -Wall -O3 ajccc.cpp -o ajccc.o
ajccc.cpp: In function `std::string getMD5(std::string)':
ajccc.cpp:15: error: invalid conversion from `const char*' to `unsigned char*'
ajccc.cpp:15: error: initializing argument 2 of `void MD5Update(MD5_CTX*, unsigned char*, unsigned int)'
make: *** [ajccc.o] Error 1
Hab den scheiß gecasted, aber beim linken wills nicht :/
Code:
giuly@Campi64 ~/ajccc/ajccc $ g++ -o ajccc md5.o tinyxml.o tinyxmlparser.o tinyxmlerror.o tinystr.o ajccc.o
ajccc.o(.text+0x2ea): In function `getMD5(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `MD5Init(MD5_CTX*)'
ajccc.o(.text+0x2ff): In function `getMD5(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `MD5Update(MD5_CTX*, unsigned char*, unsigned int)'
ajccc.o(.text+0x309): In function `getMD5(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `MD5Final(MD5_CTX*)'
collect2: ld returned 1 exit status
giuly@Campi64 ~/ajccc/ajccc $ g++ -o ajccc tinyxml.o tinyxmlparser.o tinyxmlerror.o tinystr.o ajccc.o
ajccc.o(.text+0x2ea): In function `getMD5(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `MD5Init(MD5_CTX*)'
ajccc.o(.text+0x2ff): In function `getMD5(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `MD5Update(MD5_CTX*, unsigned char*, unsigned int)'
ajccc.o(.text+0x309): In function `getMD5(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `MD5Final(MD5_CTX*)'
collect2: ld returned 1 exit status
Sind die .os von gcc mit g++ inkompatibel oder was?
Lesezeichen