Qt无法打开包含文件:'QPrinter'

Mat*_*t M 13 qt qmake include

我是Qt的新手.下载了SourceForge的Qt应用程序的源代码,并尝试构建并运行它.通过QT +=向.pro文件添加语句来解决一些类似的问题后,我坚持这个:

在尝试构建Qt Creator时,我得到错误说

错误:C1083:无法打开包含文件:'QPrinter':没有这样的文件或目录

我尝试添加QT += printsupport.pro文件,清理和重建,但这会产生此错误

错误:依赖'..\..\..\..\..\..\..\..\..\..\..\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport\qtprintsupportglobal.h'不存在."

当我去的时候C:\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport,qtprintsupportglobal.h就在那里!

小智 15

您必须将QPrinter支持添加到项目的.pro文件中:

QT += printsupport
Run Code Online (Sandbox Code Playgroud)


Pav*_*vel 5

在我的情况下,解决方案是

删除阴影构建目录并再次构建

添加printsupport,正如@KubaOber在评论中建议的那样.