[plug] Linking's a bitch!

Mike Holland myk at golden.wattle.id.au
Mon May 29 14:20:24 WST 2000


On Sat, 27 May 2000, Ben Burns wrote:

> ants.o main.o antsview.o -lqt -L/usr/lib -lkdeui -lkfm

Is that link order right? Think about the dependencies. Woulnt the KDE
libraries depend on the QT, so need to be linked first?

> /usr/include/qt/qarray.h(.text+0x22): undefined reference to `AntsDoc virtual table'

You dont have a vtable in any of the .o files. This depends on the
compiler, but from memory, it means the first (non-virtual??) member
function of the class has not been defined. Have you implemented all the
member functions?

> /home/ben/ants/ants/antsdoc.cpp:117: undefined reference to `AntsDoc::setModified(bool)'

Well that looks simpler - have you defined the function? Wrong arg type?

> 	Not exactly sure what a virtual table is and therefore what is

Well if you want to program in C++, you should read about it.

> AntsDoc::setModified(bool) are defined in antsdoc.h,

Way off the mark. Read about declaration vs definition.

> included in antsdoc.cpp, which gets compiled into antsdoc.o.  So I
> thought these functions would be available for link.

No, you must implement, not just declare.

> 	AntsView::QPaintDevice is an object in the QT library - called
> as a result of creating and using a QPainter.  The QPaintDevice should
> be available in the qt library.  By the way - its refering to

hang on "Doc"? "View"? .... AAARRRRGGGG! An MFC programmer!!!!
Begone foul beast!!

Isnt AntsView your class? How can a subclass "AntsView::QPaintDevice" be
in the QT library then? Why are you subclassing?


Mike Holland  <mike at golden.wattle.id.au>
                          --==--





More information about the plug mailing list