[plug] Linking's a bitch!

Ben Burns bburns at Mailops.Com
Sun May 28 02:21:01 WST 2000


Hi everyone,

I was wondering if anyone could help me with a linux C++ linking
problem, that originated while attempting to compile a project of mine
under KDevelop?  What follows is the command line that KDevelop sends to
the shell and the programs respone on Standard Error. 

My Command Line

$../libtool --silent --mode=link g++ -o test antsdoc.o
ants.o main.o antsview.o -lqt -L/usr/lib -lkdeui -lkfm
-lXext -L/usr/X11R6/lib -lX11 -rpath /usr/lib -rpath 
/usr/X11R6/lib -lkdecore -lkfile > error 2>&1

Output on Standard Error

antsdoc.o: In function `QArrayT<char>::data(void) const':
/usr/include/qt/qarray.h(.text+0x22): undefined reference to `AntsDoc virtual table'
antsdoc.o: In function `AntsDoc::~AntsDoc(void)':
/home/ben/ants/ants/antsdoc.cpp:43: undefined reference to `AntsDoc virtual table'
antsdoc.o: In function `AntsDoc::saveModified(void)':
/home/ben/ants/ants/antsdoc.cpp:117: undefined reference to `AntsDoc::setModified(bool)'
ants.o: In function `QListT<char>::deleteItem(void *)':
/usr/include/qt/qstrlist.h(.text+0x1b): undefined reference to `AntsApp::QPaintDevice virtual table'
/usr/include/qt/qstrlist.h(.text+0x22): undefined reference to `AntsApp virtual table'
ants.o: In function `AntsApp::~AntsApp(void)':
/home/ben/ants/ants/ants.cpp:63: undefined reference to `AntsApp::QPaintDevice virtual table'
/home/ben/ants/ants/ants.cpp:63: undefined reference to `AntsApp virtual table'
ants.o: In function `AntsApp::saveProperties(KConfig *)':
/home/ben/ants/ants/ants.cpp:340: undefined reference to `AntsDoc::isModified(void)'
/home/ben/ants/ants/ants.cpp:349: undefined reference to `AntsDoc::isModified(void)'
ants.o: In function `AntsApp::readProperties(KConfig *)':
/home/ben/ants/ants/ants.cpp:369: undefined reference to `AntsDoc::setModified(bool)'
antsview.o: In function `QRect::bottom(void) const':
/usr/include/qt/qrect.h(.text+0x20): undefined reference to `AntsView::QPaintDevice virtual table'
/usr/include/qt/qrect.h(.text+0x27): undefined reference to `AntsView virtual table'
antsview.o: In function `AntsView::~AntsView(void)':
/home/ben/ants/ants/antsview.cpp:34: undefined reference to `AntsView::QPaintDevice virtual table'
/home/ben/ants/ants/antsview.cpp:34: undefined reference to `AntsView virtual table'
collect2: ld returned 1 exit status

Sorry - pls don't read this as spam - its what I'm looking at right now.

My Analysis:
	There are link errors :)
	Not exactly sure what a virtual table is and therefore what is
referencing it and how it is undefined?
 	The functions AntsDoc::isModified(void) and AntsDoc::setModified(bool) are defined in antsdoc.h, but antsdoc.h is included in antsdoc.cpp, which gets compiled into antsdoc.o.  So I thought these functions would be available for link.
	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 libqt.so.1.44 library.  I tried to point it at the 2.0.1 version and the linker complained that the kfile library was probably not compatible with it.
	The solution is probably quite simple and the detail unnecessary.


Cheers,
Ben

bburns at mailops.com
<witty_comment>Insert witty comment here</witty_comment>



More information about the plug mailing list