.pro中加入
LIBS += -lpthread libwsock32 libws2_32 在头文件中加入
#include <QCoreApplication> #include <WinSock2.h> #include <Windows.h> #include <iostream> using namespace std;