誰能告訴我什麼是在這個程序中的錯誤沒有匹配函數調用「改造
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string str = "Now";
transform(str.begin(), str.end(), str.begin(), toupper);
cout<<str;
return 0;
}
錯誤:
"no matching function for call to 'transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)'
compilation terminated due to -Wfatal-errors."
試試......,:toupper);' –
嘗試'#include'然後'std :: ctype :: toupper'作爲參數。 –
當您處理錯誤時,您無法弄清楚,因爲該開關可以抑制相關信息,所以編譯時可能不會出現'-Wfatal-errors'錯誤。 – Praetorian