天天看點

使用QCustomPlot遇到的問題及解決

最近工作需要,産品界面中需要用到顯示實時波形,于是使用了QCustomPlot類庫。這裡寫一下遇到的問題和解決。

E:\HH-PM001\build-detecter-Desktop_Qt_5_8_0_MinGW_32bit-Debug\debug\qcustomplot.o:-1: In function `ZN11QCustomPlot7savePdfERK7QStringiiN3QCP9ExportPenES2_S2_':

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14244: error: undefined reference to `_imp___ZN8QPrinterC1ENS_11PrinterModeE'

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14246: error: undefined reference to `_imp___ZN8QPrinter15setOutputFormatENS_12OutputFormatE'

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14247: error: undefined reference to `_imp___ZN8QPrinter12setColorModeENS_9ColorModeE'

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14248: error: undefined reference to `_imp___ZNK8QPrinter11printEngineEv'

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14249: error: undefined reference to `_imp___ZNK8QPrinter11printEngineEv'

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14244: error: undefined reference to `_imp___ZN8QPrinterD1Ev'

E:\HH-PM001\trunk\QCustomPlot\qcustomplot.cpp:14244: error: undefined reference to `_imp___ZN8QPrinterD1Ev'

collect2.exe:-1: error: error: ld returned 1 exit status

認真看了一下,原來我忘記在工程檔案.pro檔案中添加下面的語句了。

QT  +=  printsupport
           
添加後,一切正常,因為qcustomplot.cpp中使用到了列印功能,是以這個是需要添加的。