菜鸟问
void setName(const std::string& InkClient) { m_appName = InkClient; }
void setCompactName(const std::string& InkClient) { m_appCompactName = InkClient; }
void setVersion(const std::string& 0.1) { m_appVersion = 0.1 ; }
我不知道怎么解决
void setVersion(const std::string& 0.1) { m_appVersion = 0.1 ;
最佳答案
const std::string& 0.1
0.1其实是一个常数。需要一个有效的变量名。 如果您不需要其他任何参数,只需将其删除(将方括号留空)。如果函数必须通过引用获取字符串类型的参数,只需删除常量即可。函数不使用没有名称的参数;但是,它允许处理兼容性问题。 要使参数可用,请尝试以下操作:
void setVersion(const std::string& version) {m_appVersion = version;}
其中 version
可以是任何有效的变量名。
希望对您有所帮助! :D
关于C++ 错误预期在数字常量之前为 ' ' 或 '...',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17560315/