G
Gerald I. Evenden
Working on a Kubuntu 64bit system "c++ (GCC) 4.0.3".
The following simple program extracted from p.497 & 499 of N.M.Josurris'
"The C++ Standard Library ... " (file t.cpp):
1 #include <string>
2 #include <iostream>
3 #include <algorithm>
4 #include <cctype>
5 using namespace std;
6 int main() {
7 string s("This is the zip code of Hodna 1223");
8 cout << "original: " << s <<endl;
9 transform(s.begin(), s.end(),s.begin(), toupper);
10 cout << "upper: " << s << endl;
11 }
results in the following error output when executing 'c++ t.cpp'
t.cpp: In function ‘int main()’:
t.cpp:9: error: 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> > >, <unknown type>)’
Something seems seriously wrong but I can't figure it.
Help, suggestions greatly appreciated.
The following simple program extracted from p.497 & 499 of N.M.Josurris'
"The C++ Standard Library ... " (file t.cpp):
1 #include <string>
2 #include <iostream>
3 #include <algorithm>
4 #include <cctype>
5 using namespace std;
6 int main() {
7 string s("This is the zip code of Hodna 1223");
8 cout << "original: " << s <<endl;
9 transform(s.begin(), s.end(),s.begin(), toupper);
10 cout << "upper: " << s << endl;
11 }
results in the following error output when executing 'c++ t.cpp'
t.cpp: In function ‘int main()’:
t.cpp:9: error: 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> > >, <unknown type>)’
Something seems seriously wrong but I can't figure it.
Help, suggestions greatly appreciated.