C++ 无法打开包含文件:'QWebView':没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19066656/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot open include file: 'QWebView': No such file or directory
提问by Dimo
I have followed the instructions on the following page:
我已按照以下页面上的说明进行操作:
http://qt-project.org/wiki/Open_Web_Page_in_QWebView
http://qt-project.org/wiki/Open_Web_Page_in_QWebView
I added QT += webkit in my pro file and ran qmake, then clean all and compile again. I still get:
我在我的 pro 文件中添加了 QT += webkit 并运行了 qmake,然后全部清理并再次编译。我仍然得到:
error: C1083: Cannot open include file: 'QWebView': No such file or directory
错误:C1083:无法打开包含文件:'QWebView':没有那个文件或目录
when I add #include <QWebView>
in header and cpp file. Any ideas?
当我添加#include <QWebView>
标题和 cpp 文件时。有任何想法吗?
回答by Dimo
I had to add QT += webkit webkitwidgets
as well in the pro file for it to work.
我还必须QT += webkit webkitwidgets
在 pro 文件中添加它才能工作。
回答by Francois Botha
I had to add the libqtwebkit-dev
package for my app to compile.
我必须libqtwebkit-dev
为我的应用程序添加包才能编译。
回答by vinaut
It works fine for me, on a mac with homebrew install.
在安装了自制软件的 Mac 上,它对我来说很好用。
Open the Makefilegenerated by qmake
打开qmake生成的Makefile
There should be a variable called INCPATH
, and one of the paths listed should end with /include
.
应该有一个名为 的变量INCPATH
,并且列出的路径之一应该以/include
.
List this directory and make it exists, and the many QXXXX directories and header files are present (in particular QWebKit).
列出该目录并使其存在,并且存在许多 QXXXX 目录和头文件(特别是 QWebKit)。
If everything seems to be ok, please detail how you are naming the files and what commands are you using to generate the makefile with qmake and then compiling.
如果一切正常,请详细说明您如何命名文件以及您使用哪些命令通过 qmake 生成 makefile 然后进行编译。
回答by Rick Timmis
I ran into the same issue on Kubuntu 18.10. My development environment was for Qt5 and I needed to install
我在 Kubuntu 18.10 上遇到了同样的问题。我的开发环境是针对 Qt5 的,我需要安装
libqt5webkit5-dev
libqt5webkit5-dev
apt install libqt5webkit5-dev
apt 安装 libqt5webkit5-dev