Qt Cannot open include file: 'QPrinter'

☆樱花仙子☆ 提交于 2019-12-01 14:52:32

问题


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!


回答1:


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

QT += printsupport



回答2:


In my case the solution was to

Delete the shadow build directory and build again

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



来源:https://stackoverflow.com/questions/19145763/qt-cannot-open-include-file-qprinter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!