How to link external library

Petr Hlozek petr_hl at mrp.cz
Tue Mar 8 14:40:24 GMT 2005


Dne út 8. března 2005 14:48 Alvin Beach napsal(a):
> On March 8, 2005 08:20 am, Petr Hlozek wrote:
> > Dne út 8. března 2005 00:15 Alvin Beach napsal(a):
> > > On March 7, 2005 05:01 pm, Petr Hlozek wrote:
> > > > #include <hamlib/rigclass.h>
> > > > int main(int argc, char *argv[])
> > > > {
> > > > 	Rig myRig = Rig(RIG_MODEL_DUMMY);
> > > >
> > > > 	try {
> > > > 		myRig.open();
> > > >
> > > > The problem is that compiler doesn't find declaration of class Rig.
> > > > This declaration is in rigclass.h. This file is in
> > > > /usr/include/hamlib. Could you help me how to make "visible"
> > > > declaration of Rig for compiler? I spend with this long time without
> > > > succes.
> > >
> > > You need to specify the hamlib library in the Automanager. Open the
> > > Automake manager on the right. Right click on the binary and select
> > > Options. In the Libraries tab add -l<name of hamlib library> (e.g.
> > > -lhamlib).
> >
> > Thanks for help but it still doesn't work. I added library to Link
> > libraries outsite the project. I added -lhamlib.
> > I got:
> >
> > if g++ -DHAVE_CONFIG_H -I. -I/home/ok2cqr/kdevelop/hamradio/src -I.. -O0
> > -g3 -MT hamradio.o -MD -MP -MF ".deps/hamradio.Tpo" -c -o
> > hamradio.o /home/ok2cqr/kdevelop/hamradio/src/hamradio.cpp; then mv -f
> > ".deps/hamradio.Tpo" ".deps/hamradio.Po"; else rm -f
> > ".deps/hamradio.Tpo"; exit 1; fi
> > /bin/sh ../libtool --mode=link g++ -O0 -g3 -o hamradio hamradio.o
> > -lhamlib mkdir .libs
> > g++ -O0 -g3 -o hamradio hamradio.o /usr/lib/libhamlib.so -ldl -lm
> > hamradio.o(.text+0x12b): In function `main':
> > /home/ok2cqr/kdevelop/hamradio/src/hamradio.cpp:36: undefined reference
> > to `Rig::Rig(int)'
> > hamradio.o(.text+0x13a):/home/ok2cqr/kdevelop/hamradio/src/hamradio.cpp:3
> >9: undefined reference to `Rig::open()'
> >
> > I tried Build->Clean project and run Automake + configure + build again.
> > Still nothing. :-(.
> > Any idea?
>
> Hmmm, looks like it found the library as I don't see any "hamlib not found"
> messages. Does hamlib define a namespace?
I don't know. The h file is on http://www.webpark.cz/ok2cqr/rigclass.h
I used to Delphi. I was simple. In C++ I feel lost :-(.

Petr
-- 
MandrakeLinux 10.1 Official, kernel 2.6.8.1-24mdk, KDE 3.2.3
web  : www.webpark.cz/ok2cqr
mail : ok2cqr at post dot cz; petr_hl at mrp dot cz
ICQ  : 165536992

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe ťyour-email-addressŤ



More information about the KDevelop mailing list