我是 QT 编程的新手,这让我很困惑。我已经搜索了这个问题的答案,但我找到的答案并没有解决我的问题。一般来说,我在网上找到的答案都是说要添加QT += network
到我的 .pro 文件中。但是,我的 .pro 文件中已经有了它,但尚未修复。
有什么建议么?
。轮廓
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = firstproject
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
IB_API_with_Qt/src/IBClient.cpp \
IB_API_with_Qt/src/EQtClientSocket.cpp \
IB_API_with_Qt/src/EClientSocketBase.cpp
HEADERS += mainwindow.h \
IB_API_with_Qt/include/TwsSocketClientErrors.h \
IB_API_with_Qt/include/ScannerSubscription.h \
IB_API_with_Qt/include/OrderState.h \
IB_API_with_Qt/include/Order.h \
IB_API_with_Qt/include/IBClient.h \
IB_API_with_Qt/include/Execution.h \
IB_API_with_Qt/include/EWrapper.h \
IB_API_with_Qt/include/EQtClientSocket.h \
IB_API_with_Qt/include/EClientSocketBaseImpl.h \
IB_API_with_Qt/include/EClientSocketBase.h \
IB_API_with_Qt/include/EClient.h \
IB_API_with_Qt/include/Contract.h \
IB_API_with_Qt/include/CommonDefs.h
FORMS += mainwindow.ui
错误发生在头文件中,它简单地说:
#include <QAbstractSocket>
这就是编译输出为我提供的:
21:36:05: Running steps for project firstproject...
21:36:05: Configuration unchanged, skipping qmake step.
21:36:05: Starting: "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe"
C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_QML_DEBUG -
DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\..\..
\..\..\Qt\Qt5.0.0\5.0.0\msvc2010\include" -I"..\..\..\..\..\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtWidgets" -I"..\..\..
\..\..\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtGui" -I"..\..\..\..\..\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore" -I"debug"
-I"." -I"." -I"..\..\..\..\..\Qt\Qt5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Fodebug\ @C:\Users\Terence\AppData
\Local\Temp\mainwindow.obj.5272.47.jom
mainwindow.cpp
c:\users\terence\documents\qt projects\firstproject\IB_API_with_Qt/include/IBClient.h(6) : fatal error C1083: Cannot
open include file: 'QAbstractSocket': No such file or directory
jom: C:\Users\Terence\Documents\QT Projects\firstproject-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug
\Makefile.Debug [debug\mainwindow.obj] Error 2
jom: C:\Users\Terence\Documents\QT Projects\firstproject-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\Makefile
[debug] Error 2
21:36:08: The process "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project firstproject (kit: Desktop Qt 5.0.0 MSVC2010 32bit (SDK))
When executing step 'Make'