在VS里编译可以通过,到了codelite 就一直报错
//重载操作符<<
friend ostream& operator<<(ostream &os,MyString &str);
后来经过查询源码,找到了原因
可能原因,vs++内部会做优化,自动加上const,g++编译器是严格匹配
//重载操作符<<
friend ostream& operator<<(ostream &os,const MyString &str);
改成这样就可以编译通过了。