error: invalid initialization of non-const reference of type ‘*&’ from a temporary of type

来源:互联网 发布:java object 转int 编辑:程序博客网 时间:2024/05/17 01:22

属于函数参数引用临时变量错误


解决方案:函数声明和定义中在该参数的类型前添加const关键字。 
例:void test_func(string &str); 
将其改为:void test_func(const string &str); 
在该函数实现中的对应位置做同样的改动。

阅读全文
0 0