PDA

View Full Version : Unresolved external error in Qt5 when using QPrinter



alizadeh91
19th July 2012, 08:39
Hi all...
I've getting a unresolved external error when compiling a program with Qt5 which has QPrinter object. Simply i define a QPrinter object and get the error.
Is this a bug?!

The Code:

#include <QApplication>
#include "mainwindow.h"
#include <QPrinter>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

QPrinter printer; <= This is where the error comes...

return a.exec();
}

ChrisW67
19th July 2012, 08:45
From the QtPrintSupport module docs (http://qt-project.org/doc/qt-5.0/qtprintsupport-module.html)


To include the definitions of the module's classes, use the following directive:

#include <QtPrintSupport>

To link against the module, add this line to your qmake .pro file:

QT += printsupport

alizadeh91
19th July 2012, 08:58
Thanks Solved :)