Qt 无法打开包含文件:'QPrinter' [英] Qt Cannot open include file: 'QPrinter'
问题描述
我是 Qt 的新手.下载 SourceForge 的 Qt 应用程序的源代码,并尝试构建和运行它.通过将 QT +=
语句添加到 .pro 文件解决了一些类似问题后,我被困在这个问题上:
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:
在尝试构建 Qt Creator 时,我收到错误提示
On attempting to build in Qt Creator, I get errors saying
错误:C1083:无法打开包含文件:'QPrinter':没有这样的文件或目录
error: C1083: Cannot open include file: 'QPrinter': No such file or directory
我尝试将 QT += printsupport
添加到 .pro 文件中,进行清理和重建,但出现此错误
I tried adding QT += printsupport
to the .pro file, cleaning, and rebuilding, but that gives this error
错误:依赖 '......................QtQt5.1.15.1.1msvc2012_64includeQtPrintSupportqtprintsupportglobal.h' 不存在."
Error: dependent '......................QtQt5.1.15.1.1msvc2012_64includeQtPrintSupportqtprintsupportglobal.h' does not exist."
当我转到 C:QtQt5.1.15.1.1msvc2012_64includeQtPrintSupport
时,qtprintsupportglobal.h 就在那里!
When I go to C:QtQt5.1.15.1.1msvc2012_64includeQtPrintSupport
, qtprintsupportglobal.h IS THERE!
推荐答案
您必须在项目的 .pro 文件中添加 QPrinter Support:
You have to add QPrinter Support to your project's .pro file:
QT += printsupport
这篇关于Qt 无法打开包含文件:'QPrinter'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!