Reputation: 353
When I try to compile my test app it fails.
CMakeLists.txt:
cmake_minimum_required( VERSION 2.8.8 )
project( webkit-test )
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package( Qt5Core )
find_package( Qt5Gui )
find_package( Qt5OpenGL )
find_package( Qt5Network )
find_package( Qt5WebKit )
find_package( Qt5Widgets )
add_executable( webkit-test main.cpp )
qt5_use_modules( webkit-test Core Gui OpenGL Network WebKit Widgets )
C++ code:
#include <QtWidgets/QApplication>
#include <QtWebKit/QWebView>
int main( int argc, char *argv[] )
{
QString file;
if ( argc >= 2 )
file = argv[1];
QApplication a( argc, argv );
return a.exec();
}
I generate makefile by cmake -G "NMake Makefiles"
(3) and then use nmake
(4).
After I received that I used dumpbin /EXPORTS QtWebKit5.dll > QtWebKit5.dll.exports.txt
and dumpbin /EXPORTS QtWebKit5.lib > QtWebKit5.lib.exports.txt
for seeing to exporting symbols: (5) and (6).
By using Ctrl+F you can find in these files "unresolved" external symbols:
?staticMetaObject@QWebPage@@2UQMetaObject@@B (public: static struct QMetaObject const QWebPage::staticMetaObject)
?staticMetaObject@QWebView@@2UQMetaObject@@B (public: static struct QMetaObject const QWebView::staticMetaObject)
If symbols are in QtWebKit5.lib, why I have these errors when linking?
Upvotes: 2
Views: 1739
Reputation: 3689
some reasons affect to this,
if you use Qt with version greater than 4.7, add this namespace to your project's ".pro" file:
QT += webkitwidgets
and if less equals than 4.7:
QT += webkit
and change your QWebView library to (if gets a warning about "No such file or directory" do not worry!)
#include <QwebView>
Upvotes: 2
Reputation: 353
I added add_definitions(-DQT_DLL)
to my CMakeLists.txt and now it's compiled.
Upvotes: 1