问题
i got hard to print report using NCReport library
so there an other esay solution for printing
i always got errors when i want to compiler my programme using qt 4.8.5 and ncreport engine
her is the error
C:\test\build-Ncreport-Qt_4_8_5_MinGW_32_bit-Debug\debug\mainwindow.o:-1: In function `MainWindow':
C:\test\Ncreport\mainwindow.cpp:12: erreur : undefined reference to `_imp___ZN8NCReportC1EP7QObject'
C:\test\Ncreport\mainwindow.cpp:13: erreur : undefined reference to `_imp___ZN8NCReport5resetEb'
C:\test\Ncreport\mainwindow.cpp:14: erreur : undefined reference to `_imp___ZN8NCReport13setReportFileERK7QString'
C:\test\Ncreport\mainwindow.cpp:15: erreur : undefined reference to `_imp___ZN8NCReport18runReportToPrinterEibP7QWidgetRK7QString'
C:\test\Ncreport\mainwindow.cpp:12: erreur : undefined reference to `_imp___ZN8NCReportC1EP7QObject'
C:\test\Ncreport\mainwindow.cpp:13: erreur : undefined reference to `_imp___ZN8NCReport5resetEb'
C:\test\Ncreport\mainwindow.cpp:14: erreur : undefined reference to `_imp___ZN8NCReport13setReportFileERK7QString'
C:\test\Ncreport\mainwindow.cpp:14: erreur : undefined reference to `_imp___ZN8NCReport13setReportFileERK7QString'
C:\test\Ncreport\mainwindow.cpp:15: erreur : undefined reference to `_imp___ZN8NCReport18runReportToPrinterEibP7QWidgetRK7QString'
:-1: erreur : collect2: ld returned 1 exit status
回答1:
You need to use the following with qmake:
LIBS += -L C:/test/Ncreport/lib -lNCReport2
where libNCReport2.a
will be the name of the ncreport library, i.e. you do not need to use the "lib" prefix, nor the ".a" extension.
If that still does not help with the undefined symbols, you need to go down the way to actually look into the static library whether the symbols are present that you are trying to use in your application, i.e. whether your application is compatible with the NociSoft software they provided for you.
You can check the symbols with mingw since it has the 'nm' binary installed by default. If the symbols are not present, you will either need to grab the compatible version from NociSoft, or you need to comply in your application with the library you have.
回答2:
QtRPT and QtRptDesigner
QtRPT is the easy-to-use print report engine written in C++ QtToolkit. It allows combining several reports in one XML file. For separately taken field, you can specify some condition depending on which this field will display in different font and background color, etc. The project consists of two parts: report library QtRPT and report designer application QtRptDesigner. Report file is a file in XML format. The report designer makes easy to create report XML file. Thanks to Qt library, our project can be used in programs for work in the operating systems Windows, Linux, MacOS
http://qtrpt.sourceforge.net/
来源:https://stackoverflow.com/questions/18766034/free-and-easy-qt-5-1-0-or-qt-4-8-5-reporting-engine