简体   繁体   English

QT QUdpSocket:没有这样的文件或目录

[英]QT QUdpSocket: No such file or directory

I am using QT Creator to build a program that receives UDP data packets. 我正在使用QT Creator来构建一个接收UDP数据包的程序。

I am trying to include QUdpSocket library, but it throws the following error (triplicated in the same line): 我试图包括QUdpSocket库,但它引发以下错误(在同一行中重复):

mainwindow.h:6: error: C1083: 'QUdpSocket': No such file or directory mainwindow.h:6:错误:C1083:'QUdpSocket':没有这样的文件或目录

I've included QT += network line to .pro file, but it keeps returning the error. 我已经将QT += network行包含到.pro文件中,但是它一直在返回错误。

I've checked that I have QUdpSocket and qudpsocket.h files in "C:\\Qt\\5.5\\msvc2012\\include\\QtNetwork" directory. 我检查是否在“ C:\\ Qt \\ 5.5 \\ msvc2012 \\ include \\ QtNetwork”目录中具有QUdpSocketqudpsocket.h文件。

Can anyone help me with this? 谁能帮我这个?

Thanks in advance. 提前致谢。

Version: Qt Creator 3.4.1 based on Qt 5.4.2 (MSVC 2013, 32bit) 版本:基于Qt 5.4.2的Qt Creator 3.4.1(MSVC 2013,32位)

您需要在源代码文件中添加以下内容:

include <QtNetwork/QUdpSocket>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM