You are not logged in.

pastulio

Beginner

  • "pastulio" started this thread

Posts: 2

Location: Bavaria/Germany

Occupation: Student

  • Send private message

1

Thursday, June 16th 2005, 12:25pm

cant link to kdelibs(partly)

when i try to build it I get a linker error:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "tst.h"

#include <qlabel.h>

#include <kmainwindow.h>
#include <klocale.h>

tst::tst()
    : KMainWindow( 0, "tst" )
{
    // set the shell's ui resource file
    setXMLFile("tstui.rc");
	KFileTreeView * tree = new KFileTreeView(this,"name");
	KCombiView(this,"name");
	KColorDialog * la = new KColorDialog(this,"name");
	la->show();
}

tst::~tst()
{
}


the output(using kdevelop):
cd '/p/src/tst/debug/src' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k tst
source='/p/src/tst/src/main.cpp' object='main.o' libtool=no depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' depmode=gcc3 /bin/sh /p/src/tst/admin/depcomp g++ -DHAVE_CONFIG_H -I. -I/p/src/tst/src -I.. -I/usr/kde/3.4/include -I/usr/qt/3/include -I. -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -g3 -fno-inline -O0 -g3 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -c -o main.o `test -f '/p/src/tst/src/main.cpp' || echo '/p/src/tst/src/'`/p/src/tst/src/main.cpp
/usr/qt/3/bin/moc /p/src/tst/src/tst.h -o tst.moc
source='/p/src/tst/src/tst.cpp' object='tst.o' libtool=no depfile='.deps/tst.Po' tmpdepfile='.deps/tst.TPo' depmode=gcc3 /bin/sh /p/src/tst/admin/depcomp g++ -DHAVE_CONFIG_H -I. -I/p/src/tst/src -I.. -I/usr/kde/3.4/include -I/usr/qt/3/include -I. -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -g3 -fno-inline -O0 -g3 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -c -o tst.o `test -f '/p/src/tst/src/tst.cpp' || echo '/p/src/tst/src/'`/p/src/tst/src/tst.cpp
/p/src/tst/src/tst.cpp: In member function `tst::tst()':
/p/src/tst/src/tst.cpp:34: warning: unused variable `KFileTreeView*tree'
/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -g3 -fno-inline -O0 -g3 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -o tst -R /usr/kde/3.4/lib -R /usr/qt/3/lib -R /usr/lib -L/usr/lib -L/usr/qt/3/lib -L/usr/kde/3.4/lib main.o tst.o -lkdeui
tst.o(.text+0xdc): In function `tst::tst[not-in-charge]()':
/p/src/tst/src/tst.cpp:34: undefined reference to `KFileTreeView::KFileTreeView[in-charge](QWidget*, char const*)'
tst.o(.text+0xfc):/p/src/tst/src/tst.cpp:35: undefined reference to `KCombiView::KCombiView[in-charge](QWidget*, char const*)'
tst.o(.text+0x10a):/p/src/tst/src/tst.cpp:35: undefined reference to `KCombiView::~KCombiView [in-charge]()'
tst.o(.text+0x247): In function `tst::tst[in-charge]()':
/p/src/tst/src/tst.cpp:34: undefined reference to `KFileTreeView::KFileTreeView[in-charge](QWidget*, char const*)'
tst.o(.text+0x267):/p/src/tst/src/tst.cpp:35: undefined reference to `KCombiView::KCombiView[in-charge](QWidget*, char const*)'
tst.o(.text+0x275):/p/src/tst/src/tst.cpp:35: undefined reference to `KCombiView::~KCombiView [in-charge]()'
collect2: ld returned 1 exit status
gmake: *** [tst] Error 1
*** Exited with status: 2 ***

I think it is kind of strange that I can link against KColorDialog, but not against any in KIO. Maybe one can help me fiddling it out.
General Info:
Gentoo 2005.0, kde 3.4.0, kdelibs 3.4.1-r1

output of gcc -v:
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/specs
Configured with: /var/tmp/portage/gcc-3.3.5-r1/work/gcc-3.3.5/configure --enable-version-specific-runtime-libs --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3.5 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5/info --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include/g++-v3 --host=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libgcj --enable-languages=c,c++,f77 --enable-shared --enable-threads=posix
Thread model: posix
gcc version 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)

thanks for your help

Latem

Beginner

Posts: 31

Location: New Brunswick, Canada

Occupation: Student/Programmer

  • Send private message

2

Thursday, June 16th 2005, 5:44pm

You need -lkdeio or something like that (forgot the exact string) for linking with KIO. I cant check it at work here. If you are using this from KDevelop, then you can right click on your target on the right, and in the properties add to the libraries KIO. I'll be able to double check the details when I get home. But it's either -lkio, or -lkdeio, or something similar.

Latem
The march of progress:
C:
printf("%10.2f", x);
C++:
cout << setw(10) << setprecision(2) << showpoint << x;
Java:
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

3

Thursday, June 16th 2005, 8:36pm

-lkio

Cheers,
_
Qt/KDE Developer
Debian User

Latem

Beginner

Posts: 31

Location: New Brunswick, Canada

Occupation: Student/Programmer

  • Send private message

4

Thursday, June 16th 2005, 10:18pm

Just in case, if you are doing it from KDevelop in the make target options, under the Libraries tag in "Link libraries outside the project (LDADD)", you can add $(LIB_KIO).

Latem
The march of progress:
C:
printf("%10.2f", x);
C++:
cout << setw(10) << setprecision(2) << showpoint << x;
Java:
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);

This post has been edited 1 times, last edit by "Latem" (Jun 16th 2005, 10:19pm)


pastulio

Beginner

  • "pastulio" started this thread

Posts: 2

Location: Bavaria/Germany

Occupation: Student

  • Send private message

5

Friday, June 17th 2005, 11:50am

thanks for your help, my problems are solved now