简体   繁体   English

错误:未找到需要右侧QUdpSocket的运算符

[英]error: no operator found which takes a right-hand QUdpSocket

Hello I use QT for developing I have this c++ code: 您好,我使用QT进行开发,我有以下C ++代码:

#include "udp.h"

udp::udp(QObject *parent) : QObject(parent)
{
   socket=new QUdpSocket(this);
   socket-> bind(QHostAddress::LocalHost,12345);
   connect(socket,SIGNAL(Readyread()),this ,SLOT(Readyread()));
}

This is example I just got from internet . 这是我刚从互联网上得到的例子。 well i get an error says: 好吧,我得到一个错误说:

error: C2679: binary '=' : no operator found which takes a right-hand operand of type 'QUdpSocket *' (or there is no acceptable conversion) 错误:C2679:二进制'=':找不到找到类型为'QUdpSocket *'的右侧操作数的运算符(或者没有可接受的转换)

Please guide me how can I solve this error. 请指导我如何解决此错误。

socket应声明为QUdpSocket* ,而不是QUdpSocket

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C ++没有找到需要右手操作数的&lt;&lt;运算符 - C++ No << operator found which takes right-hand operand 错误C2679:二进制&#39;&lt;&lt;&#39;:找不到运算符,该运算符使用类型为&#39;std :: string&#39;的右侧操作数 - error C2679: binary '<<':no operator found which takes a right-hand operand of type 'std::string' 错误C2679的问题:二进制&#39;+ =&#39;:未找到采用类型为&#39;int&#39;的右侧操作数的运算符 - Issue with error C2679: binary '+=': no operator found which takes a right-hand operand of type 'int' 动态数组错误帮助:“&gt;&gt;”:未找到采用“重载函数”类型的右侧操作数的运算符 - Dynamic Array Error Help: '>>': no operator found which takes a right-hand operand of type 'overloaded-function' 错误 C2679:二进制“&gt;&gt;:未找到采用“GradeType”类型的右侧操作数的运算符 - error C2679: binary ' >> : no operator found which takes a right-hand operand of type 'GradeType' 错误 C2679 二进制“&lt;&lt;”:未找到采用“T”类型右侧操作数的运算符 - Error C2679 binary '<<': no operator found which takes a right-hand operand of type 'T' 实施 emplace_back() 二进制“=”时出错:未找到采用“T *”类型右手操作数的运算符 - Error in implementing emplace_back() binary '=': no operator found which takes a right-hand operand of type 'T *' 错误C2679:二进制&#39;==&#39;:未找到采用类型为右侧的操作数的运算符 - error C2679: binary '==' : no operator found which takes a right-hand operand of type 错误C2679:二进制&#39;+&#39;:未找到采用类型为右侧的操作数的运算符 - Error C2679: binary '+' : no operator found which takes a right-hand operand of type 重载&lt;&lt;在C ++错误中的运算符:::二进制&#39;&lt;&lt;&#39;:找不到使用类型为&#39;const std :: string的右侧操作数的运算符 - Overloading the << operator in C++ error ::: binary '<<' : no operator found which takes a right-hand operand of type 'const std::string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM