[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Newbie KDE/QT Programming question...
From:       John Toon <john.toon () btinternet ! com>
Date:       2001-07-20 10:06:13
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 20 July 2001 06:52, Fabian Wolf wrote:

> Alright, let's do this step by step:

Okay, let's start from scratch.

> 1.) you compile main.cpp (no moc-keywords): "g++ -I$QTDIR/include
> - -I$KDEDIR/include -c main.cpp"

Done.

> 2.) you create a moc file: "moc mywindow.h -o mywindow.moc"

Done.

> 3.) now you compile mywindow.cpp: "g++ -I$QTDIR/include
> -I$KDEDIR/include -c mywindow.cpp

Done.

> 4.) Finally you merge 'em: "g++ -o myprog main.o mywindow.o
> -L$QTDIR/lib - -L$KDEDIR/lib -lkdecore"

Right, if I do that, when I try to execute the newly made executable, 
it reports:

[john1@localhost sillyprog]$ ./myprog
 
 
FAILURE (KCmdLineArgs):
Application has not called KCmdLineArgs::init(...).


And if I instead try compiling it with "g++ -o myprog main.o mywindow.o 
- -L$QTDIR/lib -lqt" (as per the book) it just reports:

[john1@localhost sillyprog]$ g++ -o myprog main.o mywindow.o 
- -L$QTDIR/lib -lqt
main.o: In function `main':
main.o(.text+0x3a): undefined reference to 
`KApplication::KApplication(bool, bool)'
main.o(.text+0x119): undefined reference to 
`KApplication::~KApplication(void)'
main.o(.text+0x18c): undefined reference to 
`KApplication::~KApplication(void)'
collect2: ld returned 1 exit status

> I can't see why that shouldn't work

Neither can I, which is why I'm baffled :^( What I can't understand is 
that if copying an example _exactly_ from the book it still doesn't 
work. My system is up-to-date (Kernel 2.4.6, XFree86-4.1.0).

Incidentally, my version of g++ is 2.96. Is there some sort of weird 
linker bug going on here? Will upgrading fix it? (I know that gcc is up 
to 3.0 now, so I presume that g++ has also been updated...).

John.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7WAKV/bmJi/HoKMQRAgrLAJ9EJuXQpUNq1R1MoaScSEJLuxvmnQCdGclB
Ju+tcS2mKQfMko3gEvimnTc=
=yHQb
-----END PGP SIGNATURE-----
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic