|
楼主 |
发表于 2005-7-1 15:48:19
|
显示全部楼层
测试了一下,果然编译c++程序有问题:
#include <string>
using namespace std;
int
main ()
{
string astring="Hallo Welt.";
astring.erase(0, 6); // now astring is "Welt"
return 0;
}
[root@magic kopete-0.10.1]# g++ t.cxx -o t
/usr/lib/gcc/i686-magic-linux/3.4.3/../../../../include/c++/3.4.3/bits/basic_string.h: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::erase(typename _Alloc::size_type, typename _Alloc::size_type) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
t.cxx:9: instantiated from here
/usr/lib/gcc/i686-magic-linux/3.4.3/../../../../include/c++/3.4.3/bits/basic_string.h:1040: error: invalid conversion from `void*' to `const char*'
/usr/lib/gcc/i686-magic-linux/3.4.3/../../../../include/c++/3.4.3/bits/basic_string.h:1040: error: initializing argument 3 of `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::_M_replace_safe(typename _Alloc::size_type, typename _Alloc::size_type, const _CharT*, typename _Alloc::size_type) [with _CharT= char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' |
|