您好我无法创建我的pdf文件。我正在使用我在互联网上找到的简单代码示例,但是有一些我不理解的错误。
#include <QTextDocument>
#include <QtPrintSupport/QPrinter> //My version of Qt doesnt know <QPrinter>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QTextDocument file;
file.setHtml( "<h1> "Example Text" </h1>" );
QPrinter printer;
printer.setOutputFileName("example.pdf");
printer.setOutputFormat(QPrinter::PdfFormat);
file.print(&printer);
printer.newPage();
}
错误:
debug/mainwindow.o: In function `ZN10MainWindowC2EP7QWidget':
C:\Users\Jaromír\Documents\Qt\build-PDF_test-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../PDF_test/mainwindow.cpp:18: undefined reference to `_imp___ZN8QPrinterC1ENS_11PrinterModeE'
C:\Users\Jaromír\Documents\Qt\build-PDF_test-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../PDF_test/mainwindow.cpp:19: undefined reference to `_imp___ZN8QPrinter17setOutputFileNameERK7QString'