我一开始在成员函数 fetchWeather(const QString &cityName) 后面加上了 const 关键字,而函数后面加上 const 关键字代表在该函数中不能修改成员变量,而该函数中就是需要对成员变量进行操作,所以违反了该规定,只要将 const 关键字去掉即可!
../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'std::string StudentT::getName()' discards qualifiers 原因: std::set的对象存储const StudentT 。 所以当您尝试调用getId() const对象的编译器检测到一个问题,即你调用一个const对象的非const成员函数这是不允许的,因为非const...
C++ "error:passing 'const std::vector' as 'this', default_action_ doesn't need to be declared const.It's used in const context since the member function is const qualified, so all (non-mutable) … Tags: errorpassing const stdvector as this argument discards qualifierspassing const as thi...
debug 解决方案:在方法体前加const gcc版本:4.7.23作者:Jesee出处:https://www.cnblogs.com/jeseesmith/p/16095943.html版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。分类: cppDebug 0 0 « 上一篇: 最后一位1 » 下一篇: 浮点字面值规则 ...
proxy_jni_function.cpp:199:55: error: passing ‘const AppJniCommand’ as ‘this’ argument discards qualifiers [-fpermissive] 199 | jbyte* jdata = pJniCommand->jstringToJbyte(jresult); | ^ 1. 2. 3. 错误是奇怪的,原因是简单的,就是多了个const: ...
passing as 'this' argument discards qualifiers [-fpermissive] 上网查资料后发现是因为const函数里有调用非const的函数,所以会报这个错。[1] 解决方法有 solu:不要把函数设成const === [1]https://blog.csdn.net/Pabebe/article/details/83217119
在getX()和getY()函数定义后加上const,即int getX() const,int getY() cosnt。
error: passing ‘const Objectmap {aka const std::map<std::basic_string<char>, std::shared_ptr<Objects> >}’ as ‘this’ argument of ‘std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::co...
Re: Error: passing `const state' as `this' argument of `void state::dumpStat e()' discards qualifiersNeo wrote:[color=blue] > This is my first post in C++ group, so please be nice to me. Thanks.[/color]We play nice with those who play nice with us. [color=blue]...
void process(const VideoFrame* pFrame){pFrame->saveToJpeg();} 编译时出错: error: passing ‘const VideoFrame’ as ‘this’ argument discards qualifiers [-fpermissive] 原因是参数作为const。修改如下即可: ((VideoFrame*)pFrame)->saveToJpeg();...