In member function'int Something::getValue2(const string&) const':17:68: error: passing'const std::unordered_map<std::basic_string<char>, int>'as'this'argument of'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp,...
#include "academico.h" using namespace std; int main(int argc, char** argv) { academico c; cin >> c; c.imprimir(); return 0; } error: passing 'const academico' as 'this' argument discards qualifiersc++Share Follow asked Sep 24, 2017 at 21:47 Giovanni Luis Palencia Osorio 111 bro...
错误提示: ../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'int StudentT::getId()' discards qualifiers ../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'std::string StudentT::getName()' discards qualifiers 原因: std::set的对象存储const S...
错误提示: ../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'int StudentT::getId()' discards qualifiers ../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'std::string StudentT::getName()' discards qualifiers 原因: std::set的对象存储const S...
一、error: passing 'const ...' as 'this' argument discards qualifiers [-fpermissive],本人遇到的错误发生场景是:classMainWindow::Private{public:NetWorker*netWorker;QMap<QNetworkReply*,NetWorker::ReplyType>reques
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。
这个例子中,加入set的StudentT对象都变成const对象了,那么调用getId等方法时只能调用其const版本,因为没有定义这个版本,因此编译器提示错误. 解决方法就是将getId和getName方法声明为const成员,即在函数末尾加上const关键字。
pFrame->saveToJpeg(); } 编译时出错: error: passing ‘const VideoFrame’ as ‘this’ argument discards qualifiers [-fpermissive] 1. 2. 3. 4. 5. 6. 7. 原因是参数作为const。修改如下即可: ((VideoFrame*)pFrame)->saveToJpeg(); 1....
"error: passing 'const ***' as 'this' argument of '***' discards qualifiers [-fpermissive]" when using map::erase() Feb 28, 2016 at 4:26am marco711(2) map 1 2 3 4 5 6 7 8 9 10 //Method in gestion.cppvoidGestion::EliminateObject(string nomobjetg)const{autoit = objectname...