我可以指出,我为什么会发现这些错误。 I m 采用Qt 4.7.4。 I m试图制定用户/服务器方案,利用记票进行通信。 我有工作守则(视力室2008年的工作),有双赢图书馆。 该法典拒绝与Qt合作,我尝试了几天。 我不断发现链接错误,因此我决定尝试从零开始处理QTcpS。 我包括所有必要的途径,包括档案中的道路,我正在发现链接错误。
这是我的客户:
<>上层楼>
#ifndef TOPLEVELCOMMS_H
#define TOPLEVELCOMMS_H
#include <QObject>
#include "inireader.h"
#include "WinSock2.h"
#include <QDialog>
#include <qtcpsocket.h>
#include <qhostaddress.h>
/** This class sends/receives information through sockets.
*
*/
class TopLevelComms : public QObject
{
Q_OBJECT
public:
TopLevelComms(QString hostIP, quint16 hostPort);
void connect();
private:
QTcpSocket *tcpSocket;
QHostAddress hostAddress;
quint16 hostPort;
};
#endif // TOPLEVELCOMMS_H
<>上层楼>
#include "toplevelcomms.h"
#include "stdio.h"
TopLevelComms::TopLevelComms(QString hostIP, quint16 hostPort)
{
tcpSocket = new QTcpSocket();
hostAddress.setAddress(hostIP);
this->hostPort = hostPort;
}
void TopLevelComms::connect(){
//tcpSocket->connectToHost();
}
www.un.org/Depts/DGACM/index_spanish.htm 这是。
include( $${PWD}/../qwtbuild.pri )
include( $${PWD}/../qwtconfig.pri )
QT += core gui
TARGET = TSLSuite
TEMPLATE = app
... // *all my files are declared here*
CONFIG += qwt
INCLUDEPATH += $${PWD}/../include
INCLUDEPATH += C:/QtSDK/Desktop/Qt/4.7.4/msvc2008/include/Qt
INCLUDEPATH += C:/QtSDK/Simulator/Qt/msvc2008/bin
INCLUDEPATH += C:/QtSDK/Simulator/Qt/msvc2008/include/QtNetwork
LIBS += -LC:/Qwt-6.0.1/lib -lqwt
LIBS += -LC:/Qt/4.7.4/lib -lQtSvg
www.un.org/Depts/DGACM/index_spanish.htm 产出:
11:33:57: Running build steps for project TSLSuite...
11:33:57: Configuration unchanged, skipping qmake step.
11:33:57: Starting: "C:QtSDKQtCreatorinjom.exe"
C:QtSDKQtCreatorinjom.exe -nologo -j 2 -f Makefile.Release all
linking releaseTSLSuite.exe
toplevelcomms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QHostAddress::~QHostAddress(void)" (__imp_??1QHostAddress@@QAE@XZ) referenced in function __unwindfunclet$??0TopLevelComms@@QAE@VQString@@G@Z$0
toplevelcomms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QHostAddress::setAddress(class QString const &)" (__imp_?setAddress@QHostAddress@@QAE_NABVQString@@@Z) referenced in function "public: __thiscall TopLevelComms::TopLevelComms(class QString,unsigned short)" (??0TopLevelComms@@QAE@VQString@@G@Z)
toplevelcomms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QTcpSocket::QTcpSocket(class QObject *)" (__imp_??0QTcpSocket@@QAE@PAVQObject@@@Z) referenced in function "public: __thiscall TopLevelComms::TopLevelComms(class QString,unsigned short)" (??0TopLevelComms@@QAE@VQString@@G@Z)
toplevelcomms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QHostAddress::QHostAddress(void)" (__imp_??0QHostAddress@@QAE@XZ) referenced in function "public: __thiscall TopLevelComms::TopLevelComms(class QString,unsigned short)" (??0TopLevelComms@@QAE@VQString@@G@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QTcpSocket::metaObject(void)const " (?metaObject@QTcpSocket@@UBEPBUQMetaObject@@XZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QTcpSocket::qt_metacast(char const *)" (?qt_metacast@QTcpSocket@@UAEPAXPBD@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QTcpSocket::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QTcpSocket@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QAbstractSocket::isSequential(void)const " (?isSequential@QAbstractSocket@@UBE_NXZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QAbstractSocket::close(void)" (?close@QAbstractSocket@@UAEXXZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QAbstractSocket::atEnd(void)const " (?atEnd@QAbstractSocket@@UBE_NXZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual __int64 __thiscall QAbstractSocket::bytesAvailable(void)const " (?bytesAvailable@QAbstractSocket@@UBE_JXZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual __int64 __thiscall QAbstractSocket::bytesToWrite(void)const " (?bytesToWrite@QAbstractSocket@@UBE_JXZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QAbstractSocket::canReadLine(void)const " (?canReadLine@QAbstractSocket@@UBE_NXZ)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QAbstractSocket::waitForReadyRead(int)" (?waitForReadyRead@QAbstractSocket@@UAE_NH@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QAbstractSocket::waitForBytesWritten(int)" (?waitForBytesWritten@QAbstractSocket@@UAE_NH@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall QAbstractSocket::readData(char *,__int64)" (?readData@QAbstractSocket@@MAE_JPAD_J@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall QAbstractSocket::readLineData(char *,__int64)" (?readLineData@QAbstractSocket@@MAE_JPAD_J@Z)
toplevelcomms.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall QAbstractSocket::writeData(char const *,__int64)" (?writeData@QAbstractSocket@@MAE_JPBD_J@Z)
toplevelcomms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QTcpSocket::~QTcpSocket(void)" (__imp_??1QTcpSocket@@UAE@XZ) referenced in function "public: virtual void * __thiscall QTcpSocket::`scalar deleting destructor (unsigned int)" (??_GQTcpSocket@@UAEPAXI@Z)
releaseTSLSuite.exe : fatal error LNK1120: 19 unresolved externals
jom 1.0.6 - empower your cores
command failed with exit code 1120
command failed with exit code 2
11:33:58: The process "C:QtSDKQtCreatorinjom.exe" exited with code 2.
Error while building project TSLSuite (target: Desktop)
When executing build step Make
I ve been getting many frustrating problems with Qt...I can never seem to find out how to properly add libraries, and every new thing I try takes forever to get working...am I missing something??
请回答下列问题:
- What is wrong with my current code, and how do I fix it?
- What am I doing wrong with Qt? Why is it so hard for me to use new libraries and classes?