Qt 下 求解错误提示,undefined reference to ‘MyThread:error(QAbstractSocket::SocketError)’
原代码片段:MyThread类继承QThreadsignals:voiderror(QTcpSocket::SocketErrorsocketError);voidMyT...
原代码片段:
MyThread类继承QThread
signals:
void error(QTcpSocket::SocketError socketError);
void MyThread::run()
{
tcpSocket = new QTcpSocket;
if (!tcpSocket->setSocketDescriptor(socketDescriptor))
{
emit error(tcpSocket->error());//把这句注释了就没错,我想知道原因
return;
}
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(revData()), Qt::DirectConnection);
exec();
} 展开
MyThread类继承QThread
signals:
void error(QTcpSocket::SocketError socketError);
void MyThread::run()
{
tcpSocket = new QTcpSocket;
if (!tcpSocket->setSocketDescriptor(socketDescriptor))
{
emit error(tcpSocket->error());//把这句注释了就没错,我想知道原因
return;
}
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(revData()), Qt::DirectConnection);
exec();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询