fanlyh 2021-04-26 10:45 采纳率: 100%
浏览 735
已采纳

提问 :c++报错 :error: no matching function for call

qt程序在终端中编译出现的问题,各位大佬,请问这怎么解决呢???

clientthread.cpp: In member function ‘void ClientThread::deng_send_work1()’:
clientthread.cpp:360:64: error: no matching function for call to ‘QTimer::singleShot(int, ClientThread*, ClientThread::deng_send_work1()::<lambda()>)’
     QTimer::singleShot(5*1000,this,[=](){m_timer0->start(500);});
                                                                ^
In file included from /usr/include/qt4/QtCore/QTimer:1:0,
                 from clientthread.h:7,
                 from clientthread.cpp:1:
/usr/include/qt4/QtCore/qtimer.h:78:17: note: candidate: static void QTimer::singleShot(int, QObject*, const char*)
     static void singleShot(int msec, QObject *receiver, const char *member);
                 ^
/usr/include/qt4/QtCore/qtimer.h:78:17: note:   no known conversion for argument 3 from ‘ClientThread::deng_send_work1()::<lambda()>’ to ‘const char*’
 

  • 写回答

8条回答 默认 最新

  • bostonAlen 2021-04-26 15:04
    关注

    这种情况建议把代码贴出来吧。

    我猜测是不是slot写法有问题,看起来在终端里是qt4

    QTimer::singleShot(time, this, &deng_send_work1);

    改成

    QTimer::singleShot(time, this, SLOT(deng_send_work1()));
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题