This forum has been archived. All content is frozen. Please use KDE Discuss instead.

undefined reference to `QWebPage::mainFrame() const'

Tags: None
(comma "," separated)
tagezi
Registered Member
Posts
2
Karma
0
OS
Hi,
I make my Plasma Widget. But when I build my project I get error:
/home/lera/Projects/tmultitran/build> make
-- Found Qt-Version 4.8.4 (using /usr/bin/qmake)
-- Found X11: /usr/lib/i386-linux-gnu/libX11.so
-- Found KDE 4.11 include dir: /usr/include
-- Found KDE 4.11 library dir: /usr/lib
-- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lera/Projects/tmultitran/build
[ 0%] Built target plasma_applet_tmultitran_automoc
Linking CXX shared module lib/plasma_applet_tmultitran.so
CMakeFiles/plasma_applet_tmultitran.dir/plasma-tmultitran.o: In function `PlasmaTMultitran::readHTML()':
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:73: undefined reference to `QWebPage::mainFrame() const'
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:73: undefined reference to `QWebFrame::toHtml() const'
CMakeFiles/plasma_applet_tmultitran.dir/plasma-tmultitran.o: In function `PlasmaTMultitran::loadUrl(QUrl)':
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:68: undefined reference to `QWebPage::mainFrame() const'
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:68: undefined reference to `QWebFrame::load(QUrl const&)'
CMakeFiles/plasma_applet_tmultitran.dir/plasma-tmultitran.o: In function `PlasmaTMultitran::init()':
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:42: undefined reference to `QWebSettings::globalSettings()'
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:42: undefined reference to `QWebSettings::setAttribute(QWebSettings::WebAttribute, bool)'
CMakeFiles/plasma_applet_tmultitran.dir/plasma-tmultitran.o: In function `PlasmaTMultitran::PlasmaTMultitran(QObject*, QList<QVariant> const&)':
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:17: undefined reference to `QWebPage::QWebPage(QObject*)'
CMakeFiles/plasma_applet_tmultitran.dir/plasma-tmultitran.o: In function `PlasmaTMultitran::~PlasmaTMultitran()':
/home/lera/Projects/tmultitran/plasma-tmultitran.cpp:25: undefined reference to `QWebPage::~QWebPage()'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/plasma_applet_tmultitran.so] Error 1
make[1]: *** [CMakeFiles/plasma_applet_tmultitran.dir/all] Error 2
make: *** [all] Error 2
*** Failure: Exit code 2 ***


Am I right that I need to add library QtWebKit in CMakeLists.txt?
This is my CMakeLists.txt:
Code: Select all
# Project Needs a name ofcourse
project(plasma-tmultitran)
 
# Find the required Libaries
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
 
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
   ${CMAKE_SOURCE_DIR}
   ${CMAKE_BINARY_DIR}
   ${KDE4_INCLUDES}
   ${QT_QTCORE_INCLUDE_DIR}
   ${QT_QTWEBKIT_INCLUDE_DIR}
   ${QT_QTGUI_INCLUDE_DIR}
   )
 
# We add our source code here
set(tutorial1_SRCS plasma-tmultitran.cpp)
 
# Now make sure all files get to the right place
kde4_add_plugin(plasma_applet_tmultitran ${tutorial1_SRCS})
target_link_libraries(plasma_applet_tmultitran
                      ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS})
 
install(TARGETS plasma_applet_tmultitran
        DESTINATION ${PLUGIN_INSTALL_DIR})
 
install(FILES plasma-applet-tmultitran.desktop
        DESTINATION ${SERVICES_INSTALL_DIR})


But if I write
Code: Select all
find_package(KDE4 QTWEBKIT REQUIRED)
, I get error:
/home/lera/Projects/tmultitran/build> make
CMake Error at CMakeLists.txt:5 (find_package):
find_package called with invalid argument "qtwebkid"

CMake Error at CMakeLists.txt:6 (include):
include could not find load file:
KDE4Defaults

CMake Error at CMakeLists.txt:22 (kde4_add_plugin):
Unknown CMake command "kde4_add_plugin".

CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Error 1
*** Failure: Exit code 2 ***


What should I do to fix it?
Please, advise me.
tagezi
Registered Member
Posts
2
Karma
0
OS
Sorry. I have already solved this problem.
Code: Select all
# Project Needs a name ofcourse
project(plasma-tmultitran)
 
# Find the required Libaries
find_package(KDE4 COMPONENTS QtWebKit REQUIRED)
include(KDE4Defaults)
 
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
   ${CMAKE_SOURCE_DIR}
   ${CMAKE_BINARY_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}
   ${KDE4_INCLUDES}
   ${QT_QTWEBKIT_INCLUDE_DIR}
   )

# We add our source code here
set(tutorial1_SRCS plasma-tmultitran.cpp)
 
# Now make sure all files get to the right place
kde4_add_plugin(plasma_applet_tmultitran ${tutorial1_SRCS})
target_link_libraries(plasma_applet_tmultitran
                      ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS}
                      ${QT_QTWEBKIT_LIBRARY})
 
install(TARGETS plasma_applet_tmultitran
        DESTINATION ${PLUGIN_INSTALL_DIR})
 
install(FILES plasma-applet-tmultitran.desktop
        DESTINATION ${SERVICES_INSTALL_DIR})


Documentation is here
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please be aware that QtWebkit is actually a component of Qt4, not KDE4 - however as requiring KDE4 automatically drags in Qt4 as well this happens to work as well.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], Yahoo [Bot]