最近在编写程序时,我使用了第三方插件qwt,正常安装之后,在编译项目时出现了下列情况:
./debug\curvewidgetclass.o: In function `CurveWidgetClass':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:5: undefined reference to `_imp___ZN7QwtPlotC2EP7QWidget'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:8: undefined reference to `_imp___ZN7QwtPlot6canvasEv'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:8: undefined reference to `_imp___ZN13QwtPlotPannerC1EP13QwtPlotCanvas'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:11: undefined reference to `_imp___ZN7QwtPlot6canvasEv'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:11: undefined reference to `_imp___ZN16QwtPlotMagnifierC1EP13QwtPlotCanvas'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:17: undefined reference to `_imp___ZN7QwtPlot8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:18: undefined reference to `_imp___ZN9QwtLegendC1EP7QWidget'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:18: undefined reference to `_imp___ZN7QwtPlot12insertLegendEP9QwtLegendNS_14LegendPositionEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:21: undefined reference to `_imp___ZN7QwtPlot12setAxisTitleEiRK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:22: undefined reference to `_imp___ZN7QwtPlot12setAxisScaleEiddd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:24: undefined reference to `_imp___ZN7QwtPlot12setAxisTitleEiRK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:25: undefined reference to `_imp___ZN7QwtPlot12setAxisScaleEiddd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:28: undefined reference to `_imp___ZN7QwtPlot6canvasEv'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:29: undefined reference to `_imp___ZN7QwtPlot6canvasEv'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:30: undefined reference to `_imp___ZN7QwtPlot6canvasEv'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:30: undefined reference to `_imp___ZN13QwtPlotCanvas15setBorderRadiusEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:34: undefined reference to `_imp___ZN7QwtPlot6canvasEv'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:36: undefined reference to `_imp___ZN11QwtPlotGridC1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:37: undefined reference to `_imp___ZN11QwtPlotGrid10enableXMinEb'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:38: undefined reference to `_imp___ZN11QwtPlotGrid9setMajPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:39: undefined reference to `_imp___ZN11QwtPlotGrid9setMinPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:40: undefined reference to `_imp___ZN11QwtPlotItem6attachEP7QwtPlot'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:45: undefined reference to `_imp___ZN12QwtPlotCurveC1ERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:46: undefined reference to `_imp___ZN11QwtPlotItem13setRenderHintENS_10RenderHintEb'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:47: undefined reference to `_imp___ZN12QwtPlotCurve18setLegendAttributeENS_15LegendAttributeEb'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:48: undefined reference to `_imp___ZN11QwtPlotItem6attachEP7QwtPlot'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:53: undefined reference to `_imp___ZN13QwtPlotMarkerC1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:54: undefined reference to `_imp___ZN7QwtTextC1ERK7QStringNS_10TextFormatE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:54: undefined reference to `_imp___ZN13QwtPlotMarker8setLabelERK7QwtText'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:54: undefined reference to `_imp___ZN7QwtTextD1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:55: undefined reference to `_imp___ZN13QwtPlotMarker17setLabelAlignmentE6QFlagsIN2Qt13AlignmentFlagEE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:56: undefined reference to `_imp___ZN13QwtPlotMarker12setLineStyleENS_9LineStyleE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:57: undefined reference to `_imp___ZN13QwtPlotMarker9setYValueEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:58: undefined reference to `_imp___ZN11QwtPlotItem6attachEP7QwtPlot'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:61: undefined reference to `_imp___ZN13QwtPlotMarkerC1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:62: undefined reference to `_imp___ZN7QwtTextC1ERK7QStringNS_10TextFormatE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:62: undefined reference to `_imp___ZN13QwtPlotMarker8setLabelERK7QwtText'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:62: undefined reference to `_imp___ZN7QwtTextD1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:63: undefined reference to `_imp___ZN13QwtPlotMarker17setLabelAlignmentE6QFlagsIN2Qt13AlignmentFlagEE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:64: undefined reference to `_imp___ZN13QwtPlotMarker19setLabelOrientationEN2Qt11OrientationE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:65: undefined reference to `_imp___ZN13QwtPlotMarker12setLineStyleENS_9LineStyleE'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:66: undefined reference to `_imp___ZN13QwtPlotMarker10setLinePenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:67: undefined reference to `_imp___ZN13QwtPlotMarker9setXValueEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:68: undefined reference to `_imp___ZN11QwtPlotItem6attachEP7QwtPlot'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:54: undefined reference to `_imp___ZN7QwtTextD1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:62: undefined reference to `_imp___ZN7QwtTextD1Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:5: undefined reference to `_imp___ZN7QwtPlotD2Ev'
./debug\curvewidgetclass.o: In function `ZN16CurveWidgetClass8populateEP7QVectorIdES0_I7QStringEi':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:85: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:86: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:89: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:90: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:93: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:94: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:97: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:98: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:101: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:102: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:105: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:106: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:109: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:110: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:113: undefined reference to `_imp___ZN12QwtPlotCurve6setPenERK4QPen'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:114: undefined reference to `_imp___ZN11QwtPlotItem8setTitleERK7QString'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:133: undefined reference to `_imp___ZN12QwtPlotCurve10setSamplesERK7QVectorIdES3_'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:135: undefined reference to `_imp___ZN7QwtPlot16setAxisScaleDrawEiP12QwtScaleDraw'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:136: undefined reference to `_imp___ZN7QwtPlot20setAxisLabelRotationEid'
./debug\curvewidgetclass.o: In function `ZN16CurveWidgetClass11resizeEventEP12QResizeEvent':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.cpp:167: undefined reference to `_imp___ZN7QwtPlot11resizeEventEP12QResizeEvent'
./debug\curvewidgetclass.o: In function `TimeScaleDraw':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:28: undefined reference to `_imp___ZN12QwtScaleDrawC2Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:30: undefined reference to `_imp___ZN20QwtAbstractScaleDraw13setTickLengthEN11QwtScaleDiv8TickTypeEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:31: undefined reference to `_imp___ZN20QwtAbstractScaleDraw13setTickLengthEN11QwtScaleDiv8TickTypeEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:32: undefined reference to `_imp___ZN20QwtAbstractScaleDraw13setTickLengthEN11QwtScaleDiv8TickTypeEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:34: undefined reference to `_imp___ZN20QwtAbstractScaleDraw10setSpacingEd'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:28: undefined reference to `_imp___ZN12QwtScaleDrawD2Ev'
./debug\curvewidgetclass.o: In function `ZNK13TimeScaleDraw5labelEd':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:39: undefined reference to `_imp___ZN7QwtTextC1ERK7QStringNS_10TextFormatE'
./debug\curvewidgetclass.o:curvewidgetclass.cpp:(.rdata$_ZTV13TimeScaleDraw[vtable for TimeScaleDraw]+0x10): undefined reference to `QwtAbstractScaleDraw::draw(QPainter*, QPalette const&) const'
./debug\curvewidgetclass.o:curvewidgetclass.cpp:(.rdata$_ZTV13TimeScaleDraw[vtable for TimeScaleDraw]+0x18): undefined reference to `QwtScaleDraw::extent(QFont const&) const'
./debug\curvewidgetclass.o:curvewidgetclass.cpp:(.rdata$_ZTV13TimeScaleDraw[vtable for TimeScaleDraw]+0x1c): undefined reference to `QwtScaleDraw::drawTick(QPainter*, double, double) const'
./debug\curvewidgetclass.o:curvewidgetclass.cpp:(.rdata$_ZTV13TimeScaleDraw[vtable for TimeScaleDraw]+0x20): undefined reference to `QwtScaleDraw::drawBackbone(QPainter*) const'
./debug\curvewidgetclass.o:curvewidgetclass.cpp:(.rdata$_ZTV13TimeScaleDraw[vtable for TimeScaleDraw]+0x24): undefined reference to `QwtScaleDraw::drawLabel(QPainter*, double) const'
./debug\curvewidgetclass.o: In function `~TimeScaleDraw':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:25: undefined reference to `_imp___ZN12QwtScaleDrawD2Ev'
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/curvewidgetclass.h:25: undefined reference to `_imp___ZN12QwtScaleDrawD2Ev'
./debug\moc_curvewidgetclass.o: In function `ZN16CurveWidgetClass11qt_metacastEPKc':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/debug/moc_curvewidgetclass.cpp:71: undefined reference to `_imp___ZN7QwtPlot11qt_metacastEPKc'
./debug\moc_curvewidgetclass.o: In function `ZN16CurveWidgetClass11qt_metacallEN11QMetaObject4CallEiPPv':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/debug/moc_curvewidgetclass.cpp:76: undefined reference to `_imp___ZN7QwtPlot11qt_metacallEN11QMetaObject4CallEiPPv'
./debug\moc_curvewidgetclass.o: In function `_static_initialization_and_destruction_0':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/debug/moc_curvewidgetclass.cpp:55: undefined reference to `_imp___ZN7QwtPlot16staticMetaObjectE'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0x1c): undefined reference to `QwtPlot::event(QEvent*)'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0x40): undefined reference to `QwtPlot::sizeHint() const'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0x44): undefined reference to `QwtPlot::minimumSizeHint() const'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0xe8): undefined reference to `QwtPlot::canvasMap(int) const'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0xec): undefined reference to `QwtPlot::updateLayout()'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0xf0): undefined reference to `QwtPlot::drawCanvas(QPainter*)'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0xf4): undefined reference to `QwtPlot::drawItems(QPainter*, QRectF const&, QwtScaleMap const*) const'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0xf8): undefined reference to `QwtPlot::replot()'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0xfc): undefined reference to `QwtPlot::legendItemClicked()'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0x100): undefined reference to `QwtPlot::legendItemChecked(bool)'
./debug\moc_curvewidgetclass.o:moc_curvewidgetclass.cpp:(.rdata$_ZTV16CurveWidgetClass[vtable for CurveWidgetClass]+0x104): undefined reference to `QwtPlot::updateTabOrder()'
./debug\moc_curvewidgetclass.o: In function `~CurveWidgetClass':
E:\RemoteMonitorPromoteV4.0\RemoteMonitorPromoteV42/debug//../curvewidgetclass.h:45: undefined reference to `_imp___ZN7QwtPlotD2Ev'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\RemoteMonitorPromoteV42.exe] Error 1
mingw32-make: *** [debug] Error 2
09:30:04: 进程"D:\Qt\MinGW\bin\mingw32-make.exe"退出,退出代码 2 。
Error while building/deploying project RemoteMonitorPromoteV41 (target: 桌面)
When executing step 'Make'
让人百思不解,明明安装正确,为什么还出现找不到文件没有定义的情况?
最后我在项目文件中找到了问题,
注意其中的
" "
的地方,因为我在其他项目中直接粘贴过来,而那个项目文件用的编码为系统默认编码,现在项目编码为UTF-8编码,一粘贴,我就悲剧了,IDE竟然把 " 转化为了中文版 “ !而不是英文,系统当然找不到库文件了!
正确的是:
DEFINES += QT_DLL QWT_DLL
CONFIG(debug,debug|release):LIBS += -L"D:/Qt/qwt/lib" -lqwtd
else:LIBS += -L"D:/Qt/qwt/lib" -lqwt
INCLUDEPATH+= D:/Qt/qwt/include