Reputation: 132
I'm foraying into C++ and QT 5.9.
I'm running QT Tools for VS 2017 with QT 5.9 libraries added to VS 2017 and am building QT GUI applications without issue.
However, when I try to build a very simple example that invloves QWebEngineView or QWebEnginePage, I'm geting unresolved external symbol "__declspec(dllimport)...on QWebEngineView... I've also noticed that a few of the #includes don't match the examples on the QT 5.9 doc site...
I've uninstalled and re-installed QT 5.9 and also 5.6 a few times and included every module I could into each, just in case!
Code
#include <QtWidgets/QtWidgets>
#include <QtWidgets/QApplication>
#include <QtWebEngineWidgets/QtWebEngineWidgets>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebEngineView view;
view.show();
view.load(QUrl("http://google.com"));
return a.exec();
}
Build Output
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QWebEngineView::QWebEngineView(class QWidget *)" (__imp_??0QWebEngineView@@QEAA@PEAVQWidget@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QWebEngineView::~QWebEngineView(void)" (__imp_??1QWebEngineView@@UEAA@XZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QWebEngineView::load(class QUrl const &)" (__imp_?load@QWebEngineView@@QEAAXAEBVQUrl@@@Z) referenced in function main
Upvotes: 1
Views: 919
Reputation: 1798
You need to add the QtWebEngine library to the linker. Open the qmake .pro file and add QT += webenginewidgets
. http://doc.qt.io/qt-5/qwebengineview.html
Upvotes: 2