Hi,
while trying to compile the program, the following problem occurs. Can someone point out how this could be fixed:
cd test && make CXX=g++ CXXFLAGS="-g -Wall -Wstrict-prototypes -O2 " SYSTEMLIBS="" make[1]: Entering directory `/home/thtomi/xmlrpc++0.7/test' g++ -g -Wall -Wstrict-prototypes -O2 -I../src Validator.cpp ../libXmlRpc.a ../libXmlRpc.a -o Validator cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ Validator.cpp: In member function ‘virtual void ModerateSizeArrayCheck::execute(XmlRpc::XmlRpcValue&, XmlRpc::XmlRpcValue&)’: Validator.cpp:140: error: ambiguous overload for ‘operator+=’ in ‘s += ((XmlRpc::XmlRpcValue*)((XmlRpc::XmlRpcValue*)params)->XmlRpc::XmlRpcValue::operator[](0))->XmlRpc::XmlRpcValue::operator[]((((XmlRpc::XmlRpcValue*)((XmlRpc::XmlRpcValue*)params)->XmlRpc::XmlRpcValue::operator[](0))->XmlRpc::XmlRpcValue::size() - 1))’ /usr/include/c++/4.2/bits/basic_string.h:762: note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] /usr/include/c++/4.2/bits/basic_string.h:771: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] <near match> /usr/include/c++/4.2/bits/basic_string.h:780: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] make[1]: *** [Validator] Error 1 make[1]: Leaving directory `/home/thtomi/xmlrpc++0.7/test' make: *** [tests] Error 2
BR, Tomi
You need to explicitly cast the assignment:
std::string s = params[0][0]; --> s += static_cast<std::string>(params[0][params[0].size()-1]); result = s;
BTW, you can remove -Wstrict-prototypes from the makefile to get rid of the other [annoying] compiler output.
Pete
I have the same problem , seeking for help
can you post your a little bit more information? Something like compiler version, OS, and so on….
Log in to post a comment.
Hi,
while trying to compile the program, the following problem occurs. Can someone point out how this could be fixed:
cd test && make CXX=g++ CXXFLAGS="-g -Wall -Wstrict-prototypes -O2 " SYSTEMLIBS=""
make[1]: Entering directory `/home/thtomi/xmlrpc++0.7/test'
g++ -g -Wall -Wstrict-prototypes -O2 -I../src Validator.cpp ../libXmlRpc.a ../libXmlRpc.a -o Validator
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
Validator.cpp: In member function ‘virtual void ModerateSizeArrayCheck::execute(XmlRpc::XmlRpcValue&, XmlRpc::XmlRpcValue&)’:
Validator.cpp:140: error: ambiguous overload for ‘operator+=’ in ‘s += ((XmlRpc::XmlRpcValue*)((XmlRpc::XmlRpcValue*)params)->XmlRpc::XmlRpcValue::operator[](0))->XmlRpc::XmlRpcValue::operator[]((((XmlRpc::XmlRpcValue*)((XmlRpc::XmlRpcValue*)params)->XmlRpc::XmlRpcValue::operator[](0))->XmlRpc::XmlRpcValue::size() - 1))’
/usr/include/c++/4.2/bits/basic_string.h:762: note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/include/c++/4.2/bits/basic_string.h:771: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] <near match>
/usr/include/c++/4.2/bits/basic_string.h:780: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
make[1]: *** [Validator] Error 1
make[1]: Leaving directory `/home/thtomi/xmlrpc++0.7/test'
make: *** [tests] Error 2
BR,
Tomi
You need to explicitly cast the assignment:
std::string s = params[0][0];
--> s += static_cast<std::string>(params[0][params[0].size()-1]);
result = s;
BTW, you can remove -Wstrict-prototypes from the makefile to get rid of the other [annoying] compiler output.
Pete
I have the same problem , seeking for help
Hi,
can you post your a little bit more information? Something like compiler version, OS, and so on….