From kde-devel Wed Mar 31 23:05:43 2004 From: "Martin Welch" Date: Wed, 31 Mar 2004 23:05:43 +0000 To: kde-devel Subject: RE: Hello World newbie woes Message-Id: X-MARC-Message: https://marc.info/?l=kde-devel&m=108077423215421 >>\r? The only thing I can think of is that you wrote your scripts in a >>DOS-style editor, so the lines end in \r\n instead of \n. The \r is >>taken to be a part of the filename instead of line-termination. Yep. That's notepad for you. Thanks. I've finally got KDbg installed thanks to rpmfind and added the -g switch: c++ -c -I$KDEDIR/include -I$QTDIR/include -fno-rtti -g main.cpp -o main.o $QTDIR/bin/moc khello.h -o khello.moc c++ -c -I$KDEDIR/include -I$QTDIR/include -fno-rtti -g khello.cpp -o khello.o c++ -L$KDEDIR/lib -L$QTDIR/lib -lkdeui -lkdecore -lqt-mt -ldl -o khello -g main.o khello.o I've opened the executable in Kdbg but I can't run, step into etc -- does the g switch need to be in a particular place? Cheers! Martin -----Original Message----- From: Thiago Macieira [mailto:thiago.macieira@kdemail.net] Sent: 31 March 2004 16:19 To: kde-devel@kde.org Subject: Re: Hello World newbie woes Martin Welch wrote: >I'm fairly confident that the source code is right and its my build > scripts that are wrong. >Q1: Why does the output files (hello.o etc) always have an \r appended > to the names? \r? The only thing I can think of is that you wrote your scripts in a DOS-style editor, so the lines end in \r\n instead of \n. The \r is taken to be a part of the filename instead of line-termination. >The only thing in my scripts that's different is that I've changed -qt > to $QTDIRqt since >ld couldn't find qt. My understanding here is -L/blah says the > compiler should look in /blah for libraries and -lfoo says the > library is called foo. At runtime my program 'knows' to load foo but > doesn't know where foo resides. If, OTOH, I use -l/blah/foo my > program will expect to load foo from /blah -- the path is hardcoded. >Q2: On my machine then (L/blah -lfoo) == (-l/blah/foo) ? No, what you're doing works, but it's not the recommended way. You should be using -L/blah -lfoo to link to /blah/libfoo.so. What you're missing is telling the dynamic loader where to find those libraries. One alternative is to add the directory to /etc/ld.so.conf. Another is to specify it in LD_LIBRARY_PATH. A third, and this is what KDE uses for its own libraries, is to replace -L with -R. That'll make the linker generate an RPATH symbol on the ELF header with the pathname of where to find hte library. >From the other message: >Using host libthread_db library "/lib/tls/libthread_db.so.1". >[Thread debugging using libthread_db enabled] >[New Thread 1093039872 (LWP 2723)] >0xffffe410 in ?? () >#0 0xffffe410 in ?? () That looks like stack corruption. You'll have to run the program step-by-step on the debugger and tell us what line is faulting. Add breakpoints to your slots. Hint: never set the geometry by hand. Prefer to use grids in your dialogs. Better yet, use .ui files. -- Thiago Macieira - Registered Linux user #65028 thiago (AT) macieira (DOT) info ICQ UIN: 1967141 PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<