There are two functions called toupper . One of the cctype header:
int toupper( int ch );
And the second from the locale header:
charT toupper( charT ch, const locale& loc );
The compiler cannot determine which function should be used because you are resolving the std . You must use the region resolution operator ( :: :) to select a function defined in global space:
transform(str.begin(), str.end(), str.begin(), ::toupper);
Or, better: do not use using namespace std .
Thanks @Praetorian -
This is probably the cause of the error, but adding :: may not always work. If you included cctype toupper in the global namespace. Casting can provide the required value static_cast<int(*)(int)>(std::toupper)
So, the call should look like this:
std::transform ( str.begin(), str.end(), str.begin(), static_cast<int(*)(int)>(std::toupper) );
source share