[C++ Error] no matching function for call to 'toupper(__gnu_cxx::__alloc_traits<std::allocator<std::basic_string<char> > >::value_type&)'
高洛峰
高洛峰 2017-04-17 11:30:12
0
2
1402

菜鸟一名,求助,百度了这段错误提示,可是没找到答案。请说简单一点,刚学c++没多久。谢谢

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
左手右手慢动作

The error message is obvious, there is no such function.

It is said that there is no such function as toupper(string) in C++, and there is no such function as toupper(char *) in C. You can only use toupper(char) character by character.

左手右手慢动作

The error I see here is

toupper.cc: In function ‘int main()’:
toupper.cc:17: error: cannot convert ‘std::basic_string<char, std::char_traits<char>, std::allocator<char> >’ to ‘int’ for argument ‘1’ to ‘int toupper(int)’

http://www.cplusplus.com/reference/cctype/toupper/
From this document, it seems that toupper should be the C function, but it accepts int, and the questioner passed string, so it is not match.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template