While using the libraries of c++rest and python together in my c++ code, I get an error of function "tolower" to be undefined. I get to understand because in python pyport.h there is a
#undef tolower
#define tolower(c) towlower(btowc(c))
But at the same time c++rest/asyncrt_utils.cpp there is a private method called tolower in the cmp class.
class cmp
{
public:
static int icmp(std::string left, std::string right)
{
size_t i;
for (i = 0; i < left.size(); ++i)
{
if (i == right.size()) return 1;
auto l = cmp::tolower(left[i]);
auto r = cmp::tolower(right[i]);
if (l > r) return 1;
if (l < r) return -1;
}
if (i < right.size()) return -1;
return 0;
}
private:
static char tolower(char c)
{
if (c >= 'A' && c <= 'Z')
return static_cast<char>(c - 'A' + 'a');
return c;
}
};
What could be the solution for this? how do I make sure the compilation happens preserving both
P.S. I have tried checking the order in which these .h files get called in my code. c++rest is always called at the end of the list.
Any suggestions would be appreciated. Want to have a discussion on similar things. I would like to learn more about the compilers and how they work