15

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?

László Papp
  • 51,870
  • 39
  • 111
  • 135
Dimo
  • 3,238
  • 6
  • 29
  • 46
  • possible duplicate of [QWebView library not found](http://stackoverflow.com/questions/7162384/qwebview-library-not-found) – László Papp Sep 28 '13 at 12:19

4 Answers4

22

I had to add QT += webkit webkitwidgets as well in the pro file for it to work.

Dimo
  • 3,238
  • 6
  • 29
  • 46
  • Strange, for me it worked without any further adjustment. Maybe it's the version ? Happy to know it's working. – vinaut Sep 28 '13 at 12:16
  • Really? All the other threads just says to run qmake which I did. Can you please point me to the thread where he ran Qmake and it didnt work and the answer was to ALSO include QT += webkit webkitwidgets? – Dimo Sep 28 '13 at 12:19
  • See my duplicate flag. I left a comment there. There are several threads like this around, and you still have not presented at all why you need webkitwidgets, so it may actually be wrong. Can you provide evidence? – László Papp Sep 28 '13 at 12:35
  • No I cannot "provide evidence". All I can say is that it worked while the thread you linked to did NOT work as a solution for me. I have clearly stated that I already added QT += webkit to the pro file and it did not work. So why are you posting a question and calling it a duplicate when the solution is not the same? – Dimo Sep 28 '13 at 20:47
  • @Dimo: because you have not even pasted the code, just said: "aww, something does not work, but something made it work". We know it works well... this functionality has been tested since ever. You must be doing something wrong elsewhere. – László Papp Sep 29 '13 at 19:19
  • with CMake this would be adding `QtWebKit` to the `find_package` command – Claudiu Oct 03 '15 at 00:11
18

I had to add the libqtwebkit-dev package for my app to compile.

Francois Botha
  • 4,520
  • 1
  • 34
  • 46
2

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

0

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.

vinaut
  • 2,416
  • 15
  • 13