Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Cannot open include file: 'QPrinter'

Tags:

include

qt

qmake

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!

like image 618
Matt M Avatar asked Oct 02 '13 19:10

Matt M


2 Answers

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

QT += printsupport
like image 111
Jamal Khan Avatar answered Nov 17 '22 13:11

Jamal Khan


In my case the solution was to

Delete the shadow build directory and build again

after adding printsupport, as @KubaOber suggests in the comments.

like image 29
Pavel Avatar answered Nov 17 '22 11:11

Pavel