Hey everyone. I'm using Slackware Linux 9.1, with gcc version 3.2.3.
The error I'm getting is:
The source code for the file is:Code:Tools.cxx: In function `unsigned int StringToInt(const std::string&)': Tools.cxx:33: `tolower' undeclared (first use this function) Tools.cxx:33: (Each undeclared identifier is reported only once for each function it appears in.)
I'm not sure what's wrong here, hopefully someone here can help me out. (ps, I didn't write this code, I'm just trying to compile this so I can install a program I need for school. I haven't done any C/C++ coding for years. I'd prefer not to modify it any more then required to compile and still return the same answer)Code:17#include "Tools.hxx" 18 19/////////////////////////////////////////////////////////////////////////////// 20// Convert the hex string to an unsigned integer 21/////////////////////////////////////////////////////////////////////////////// 22unsigned int StringToInt(const string& hex) 23{ 24 static char digits[] = "0123456789abcdef"; 25 unsigned int result = 0; 26 27 for(unsigned int t = 0; t < hex.length(); ++t) 28 { 29 unsigned int digit = 0; 30 31 for(unsigned int s = 0; s < 16; ++s) 32 { 33 if(digits[s] == tolower(hex[t])) 34 { 35 digit = s; 36 break; 37 } 38 } 39 result = result * 16 + digit; 40 } 41 return(result); 42}
Thanks.




Reply With Quote