请有人给我指示。当我在 Visual Studio 中看到这样的错误时,我通常知道我缺少一个库。不过,我直接使用 qt,可以通过它自己的 ide 来说话。我不知道为什么 QTcpSocket 无法构建。
mainwindow.obj:: error: unresolved external symbol "__declspec(dllimport) public: virtual _thiscall QTcpSocket::~QTcpSocket(void)" (_imp_??1QTcpSocket@@UAE@XZ) referenced in function "public: virtual __thiscall MainWindow::~MainWindow(void)" (??1MainWindow@@UAE@XZ)
mainwindow.obj:: error: unresolved external symbol "__declspec(dllimport) public: __thiscall QTcpSocket::QTcpSocket(class QObject *)" (_imp??0QTcpSocket@@QAE@PAVQObject@@@Z) referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z)
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include <QtNetwork/QHostAddress>
#include <QtNetwork/QTcpSocket>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QTcpSocket sckSock;
private slots:
void on_pushButton_clicked();
};
#endif // MAINWINDOW_H
最佳答案
关于c++ - Qt Creator Ide,添加 QTcpSocket 实例后构建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7049090/