Qt编译出错

编译环境为win7 64位, Qt 版本为qt-opensource-windows-x86-mingw492-5.6.1

最近重新拿 《精通Qt4编程》这本书来学习,在编译书带的源代码时,报错。

编译输出如下:

20:41:54: 为项目direct执行步骤 ...

20:41:54: 配置没有改变, 跳过 qmake 步骤。

20:41:54: 正在启动 "D:\Qt\Qt5.6.1\Tools\mingw492_32\bin\mingw32-make.exe"


cd src\ && ( if not exist Makefile D:\Qt\Qt5.6.1\5.6\mingw49_32\bin\qmake.exe C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src\src.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" -o Makefile ) && D:/Qt/Qt5.6.1/Tools/mingw492_32/bin/mingw32-make -f Makefile

mingw32-make[1]: Entering directory 'C:/Users/Administrator/Desktop/Qt4Code/chapter03/findfile/direct/src'

D:/Qt/Qt5.6.1/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug

mingw32-make[2]: Entering directory 'C:/Users/Administrator/Desktop/Qt4Code/chapter03/findfile/direct/src'

g++ -Wl,-subsystem,windows -mthreads -o bin\direct.exe debug/direct.o debug/qrc_findfile.o -lmingw32 -LD:\Qt\Qt5.6.1\5.6\mingw49_32\lib D:\Qt\Qt5.6.1\5.6\mingw49_32\lib\libqtmaind.a -LC:\utils\postgresql\pgsql\lib -LC:\utils\my_sql\my_sql\lib -lshell32 D:\Qt\Qt5.6.1\5.6\mingw49_32\lib\libQt5Guid.a D:\Qt\Qt5.6.1\5.6\mingw49_32\lib\libQt5Cored.a

debug/direct.o: In function `Z5qMainiPPc':

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/direct.cpp:8: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/direct.cpp:12: undefined reference to `_imp___ZN7QWidgetC1EPS_6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/direct.cpp:15: undefined reference to `_imp___ZN7QWidget4showEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/direct.cpp:17: undefined reference to `_imp___ZN12QApplication4execEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/direct.cpp:17: undefined reference to `_imp___ZN12QApplicationD1Ev'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/direct.cpp:17: undefined reference to `_imp___ZN12QApplicationD1Ev'

debug/direct.o: In function `ZN11QSizePolicyC1ENS_6PolicyES0_NS_11ControlTypeE':

D:/Qt/Qt5.6.1/5.6/mingw49_32/include/QtWidgets/qsizepolicy.h:96: undefined reference to `_imp___ZN11QSizePolicy14setControlTypeENS_11ControlTypeE'

debug/direct.o: In function `ZN7QWidget6resizeEii':

D:/Qt/Qt5.6.1/5.6/mingw49_32/include/QtWidgets/qwidget.h:828: undefined reference to `_imp___ZN7QWidget6resizeERK5QSize'

debug/direct.o: In function `ZN11QLayoutItemC2E6QFlagsIN2Qt13AlignmentFlagEE':

D:/Qt/Qt5.6.1/5.6/mingw49_32/include/QtWidgets/qlayoutitem.h:83: undefined reference to `_imp___ZTV11QLayoutItem'

debug/direct.o: In function `ZN11QSpacerItemC1EiiN11QSizePolicy6PolicyES1_':

D:/Qt/Qt5.6.1/5.6/mingw49_32/include/QtWidgets/qlayoutitem.h:91: undefined reference to `_imp___ZTV11QSpacerItem'

D:/Qt/Qt5.6.1/5.6/mingw49_32/include/QtWidgets/qlayoutitem.h:91: undefined reference to `_imp___ZN11QLayoutItemD2Ev'

debug/direct.o: In function `ZN15Ui_FindFileForm7setupUiEP7QWidget':

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:71: undefined reference to `_imp___ZN7QWidget13setWindowIconERK5QIcon'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:72: undefined reference to `_imp___ZN11QVBoxLayoutC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:74: undefined reference to `_imp___ZN6QFrameC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:76: undefined reference to `_imp___ZN6QFrame13setFrameShapeENS_5ShapeE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:77: undefined reference to `_imp___ZN6QFrame14setFrameShadowENS_6ShadowE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:78: undefined reference to `_imp___ZN11QVBoxLayoutC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:80: undefined reference to `_imp___ZN11QGridLayoutC1Ev'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:82: undefined reference to `_imp___ZN6QLabelC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:87: undefined reference to `_imp___ZNK7QWidget10sizePolicyEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:88: undefined reference to `_imp___ZN7QWidget13setSizePolicyE11QSizePolicy'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:90: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:92: undefined reference to `_imp___ZN9QComboBoxC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:94: undefined reference to `_imp___ZN9QComboBox11setEditableEb'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:96: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:98: undefined reference to `_imp___ZN6QLabelC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:100: undefined reference to `_imp___ZNK7QWidget10sizePolicyEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:101: undefined reference to `_imp___ZN7QWidget13setSizePolicyE11QSizePolicy'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:103: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:105: undefined reference to `_imp___ZN9QLineEditC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:108: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:110: undefined reference to `_imp___ZN6QLabelC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:112: undefined reference to `_imp___ZNK7QWidget10sizePolicyEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:113: undefined reference to `_imp___ZN7QWidget13setSizePolicyE11QSizePolicy'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:115: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:117: undefined reference to `_imp___ZN9QComboBoxC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:119: undefined reference to `_imp___ZN9QComboBox11setEditableEb'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:121: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:123: undefined reference to `_imp___ZN11QPushButtonC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:128: undefined reference to `_imp___ZNK7QWidget10sizePolicyEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:129: undefined reference to `_imp___ZN7QWidget13setSizePolicyE11QSizePolicy'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:131: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetiiii6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:134: undefined reference to `_imp___ZN10QBoxLayout9addLayoutEP7QLayouti'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:136: undefined reference to `_imp___ZN11QHBoxLayoutC1Ev'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:142: undefined reference to `_imp___ZN9QCheckBoxC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:145: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:147: undefined reference to `_imp___ZN9QCheckBoxC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:150: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:157: undefined reference to `_imp___ZN10QBoxLayout9addLayoutEP7QLayouti'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:160: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:162: undefined reference to `_imp___ZN11QHBoxLayoutC1Ev'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:168: undefined reference to `_imp___ZN11QPushButtonC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:171: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:177: undefined reference to `_imp___ZN11QPushButtonC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:180: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:186: undefined reference to `_imp___ZN11QPushButtonC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:189: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:196: undefined reference to `_imp___ZN10QBoxLayout9addLayoutEP7QLayouti'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:198: undefined reference to `_imp___ZN6QLabelC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:201: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:203: undefined reference to `_imp___ZN12QTableWidgetC1EP7QWidget'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:204: undefined reference to `_imp___ZNK12QTableWidget11columnCountEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:205: undefined reference to `_imp___ZN12QTableWidget14setColumnCountEi'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:206: undefined reference to `_imp___ZN16QTableWidgetItemC1Ei'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:207: undefined reference to `_imp___ZN12QTableWidget23setHorizontalHeaderItemEiP16QTableWidgetItem'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:208: undefined reference to `_imp___ZN16QTableWidgetItemC1Ei'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:209: undefined reference to `_imp___ZN12QTableWidget23setHorizontalHeaderItemEiP16QTableWidgetItem'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:210: undefined reference to `_imp___ZN16QTableWidgetItemC1Ei'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:211: undefined reference to `_imp___ZN12QTableWidget23setHorizontalHeaderItemEiP16QTableWidgetItem'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:212: undefined reference to `_imp___ZN16QTableWidgetItemC1Ei'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:213: undefined reference to `_imp___ZN12QTableWidget23setHorizontalHeaderItemEiP16QTableWidgetItem'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:216: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:218: undefined reference to `_imp___ZN11QHBoxLayoutC1Ev'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:220: undefined reference to `_imp___ZN6QLabelC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:225: undefined reference to `_imp___ZNK7QWidget10sizePolicyEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:226: undefined reference to `_imp___ZN7QWidget13setSizePolicyE11QSizePolicy'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:227: undefined reference to `_imp___ZN6QFrame13setFrameShapeENS_5ShapeE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:228: undefined reference to `_imp___ZN6QFrame14setFrameShadowENS_6ShadowE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:230: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:232: undefined reference to `_imp___ZN6QLabelC1EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:237: undefined reference to `_imp___ZNK7QWidget10sizePolicyEv'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:238: undefined reference to `_imp___ZN7QWidget13setSizePolicyE11QSizePolicy'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:239: undefined reference to `_imp___ZN6QFrame13setFrameShapeENS_5ShapeE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:240: undefined reference to `_imp___ZN6QFrame14setFrameShadowENS_6ShadowE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:242: undefined reference to `_imp___ZN10QBoxLayout9addWidgetEP7QWidgeti6QFlagsIN2Qt13AlignmentFlagEE'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:245: undefined reference to `_imp___ZN10QBoxLayout9addLayoutEP7QLayouti'

debug/direct.o: In function `ZN15Ui_FindFileForm13retranslateUiEP7QWidget':

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:255: undefined reference to `_imp___ZN7QWidget14setWindowTitleERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:256: undefined reference to `_imp___ZN6QLabel7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:257: undefined reference to `_imp___ZN6QLabel7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:258: undefined reference to `_imp___ZN6QLabel7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:259: undefined reference to `_imp___ZN15QAbstractButton7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:260: undefined reference to `_imp___ZN15QAbstractButton7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:261: undefined reference to `_imp___ZN15QAbstractButton7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:262: undefined reference to `_imp___ZN15QAbstractButton7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:263: undefined reference to `_imp___ZN15QAbstractButton7setTextERK7QString'

debug/direct.o:C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:264: more undefined references to `_imp___ZN15QAbstractButton7setTextERK7QString' follow

debug/direct.o: In function `ZN15Ui_FindFileForm13retranslateUiEP7QWidget':

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:265: undefined reference to `_imp___ZN6QLabel7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:266: undefined reference to `_imp___ZNK12QTableWidget20horizontalHeaderItemEi'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:268: undefined reference to `_imp___ZNK12QTableWidget20horizontalHeaderItemEi'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:270: undefined reference to `_imp___ZNK12QTableWidget20horizontalHeaderItemEi'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:272: undefined reference to `_imp___ZNK12QTableWidget20horizontalHeaderItemEi'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:274: undefined reference to `_imp___ZN6QLabel7setTextERK7QString'

C:\Users\Administrator\Desktop\Qt4Code\chapter03\findfile\direct\src/ui_findfileform.h:275: undefined reference to `_imp___ZN6QLabel7setTextERK7QString'

collect2.exe: error: ld returned 1 exit status

mingw32-make[2]: *** [bin\direct.exe] Error 1

mingw32-make[1]: *** [debug] Error 2

mingw32-make: *** [sub-src-make_first] Error 2

Makefile.Debug:62: recipe for target 'bin\direct.exe' failed

mingw32-make[2]: Leaving directory 'C:/Users/Administrator/Desktop/Qt4Code/chapter03/findfile/direct/src'

Makefile:34: recipe for target 'debug' failed

mingw32-make[1]: Leaving directory 'C:/Users/Administrator/Desktop/Qt4Code/chapter03/findfile/direct/src'

makefile:38: recipe for target 'sub-src-make_first' failed

20:41:55: 进程"D:\Qt\Qt5.6.1\Tools\mingw492_32\bin\mingw32-make.exe"退出,退出代码 2 。

Error while building/deploying project direct (kit: Desktop Qt 5.6.1 MinGW 32bit)

When executing step "Make"

20:41:55: Elapsed time: 00:02.


解决办法:

在各个.pro文件中,加入如下两行:

QT       += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

Qt编译出错_第1张图片




你可能感兴趣的:(Qt)