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

Compiling with TestModel (QTest error)

Tags: None
(comma "," separated)
deadeyes
Registered Member
Posts
34
Karma
0
Hi all,

I am trying to compile some code however I get a compilation error:
http://pastebin.com/uTzAQkuS

Can someone tell me what I am doing wrong?

If you need more info please ask

EDIT: modified to a url that will not expire.

Last edited by deadeyes on Wed Jan 12, 2011 10:32 am, edited 1 time in total.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Are you linking against QtTest?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
deadeyes
Registered Member
Posts
34
Karma
0
bcooksley wrote:Are you linking against QtTest?


To be honest I have no idea. How do I check this?
Some people told me to add
QT += testlib
to the .pro file.
I am using kdevelop however, and can't find such a file.
So I expect that I need to edit CMakeLists.txt.

Do note that I almost have no experience with this.
I looked into the CMakeLists.txt but couldn't figure out what to change/add.
pinotree
KDE Developer
Posts
222
Karma
7
OS
In the target_link_library you are using to link your test, add ${QT_QTTEST_LIBRARY}, for example:
Code: Select all
target_link_library(testname .... ${QT_QTTEST_LIBRARY}


Pino Toscano
deadeyes
Registered Member
Posts
34
Karma
0
pinotree wrote:In the target_link_library you are using to link your test, add ${QT_QTTEST_LIBRARY}, for example:
Code: Select all
target_link_library(testname .... ${QT_QTTEST_LIBRARY}


I tried adding only that statement but that still failed.
So I created a new project and took a look in that CMakeLists.txt file.

I added the missing parts, resulting in this:
Code: Select all
project(diskspacefree)
find_package(KDE4 REQUIRED)
include (KDE4Defaults)

set(diskspacefree_SRCS directorymodel.cpp directoryparser.cpp directory.cpp
   diskspacefree.cpp
   main.cpp
   diskspacefreeview.cpp
   modeltest.cpp
   dynamictreemodel.cpp
 )

include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} )

cmake_minimum_required(VERSION 2.8)

kde4_add_ui_files(diskspacefree_SRCS diskspacefreeview_base.ui prefs_base.ui)

kde4_add_kcfg_files(diskspacefree_SRCS settings.kcfgc )

kde4_add_executable(diskspacefree ${diskspacefree_SRCS})

target_link_libraries(diskspacefree ${KDE4_KDEUI_LIBS} ${QT_QTTEST_LIBRARY})

install(TARGETS diskspacefree ${INSTALL_TARGETS_DEFAULT_ARGS} )


########### install files ###############

install( FILES diskspacefree.desktop  DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES diskspacefree.kcfg  DESTINATION  ${KCFG_INSTALL_DIR} )
install( FILES diskspacefreeui.rc  DESTINATION  ${DATA_INSTALL_DIR}/diskspacefree )



cmake .
and make
Linking now works :)
Thanks alot guys for your help! (I really spend alot of time on this because some people pointed me in the totally wrong direction: qmake instead of cmake)


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient