I had to add QT += webkit webkitwidgets
as well in the pro file for it to work.
Cannot open include file: 'QWebView': No such file or directory
题
I have followed the instructions on the following page:
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:
error: C1083: Cannot open include file: 'QWebView': No such file or directory
when I add #include <QWebView>
in header and cpp file. Any ideas?
解决方案
其他提示
I had to add the libqtwebkit-dev
package for my app to compile.
I ran into the same issue on Kubuntu 18.10. My development environment was for Qt5 and I needed to install
libqt5webkit5-dev
apt install libqt5webkit5-dev
It works fine for me, on a mac with homebrew install.
Open the Makefile generated by qmake
There should be a variable called INCPATH
, and one of the paths listed should end with /include
.
List this directory and make it exists, and the many QXXXX directories and header files are present (in particular 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.