Qt Cannot open include file: 'QPrinter'

Matt M picture Matt M · Oct 2, 2013 · Viewed 10.7k times · Source

I am new to Qt. Downloaded source code for a Qt application of SourceForge, and tried to build and run it. After working through a few similar problems by adding QT += statements to .pro files, I am stuck on this one:

On attempting to build in Qt Creator, I get errors saying

error: C1083: Cannot open include file: 'QPrinter': No such file or directory

I tried adding QT += printsupport to the .pro file, cleaning, and rebuilding, but that gives this error

Error: dependent '..\..\..\..\..\..\..\..\..\..\..\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport\qtprintsupportglobal.h' does not exist."

When I go to C:\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport, qtprintsupportglobal.h IS THERE!

Answer

Jamal Khan picture Jamal Khan · Nov 12, 2013

You have to add QPrinter Support to your project's .pro file:

QT += printsupport