LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-02-2005, 04:59 PM   #1
shabbychef
LQ Newbie
 
Registered: Sep 2005
Distribution: gentoo
Posts: 4

Rep: Reputation: 0
gcc linking: undefined reference to just about everything


I have a horrendous problem linking a c++ application I am `developing.'
This has something to do with pure abstract classes, virtual inheritence,
destructors, polymorphism, all the big words. The classes appear to
compile correctly, but in the link phase, i get a lot of errors. admittedly
it appears to be the same error repeated for many of the classes:

[snip]

dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symStraightE+0x24): undefined reference to `typeinfo for patlib::symStrai
ght'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symStraightE+0x4c): undefined reference to `patlib::symStraight::myBasStr
aight() const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symStraightE+0x68): undefined reference to `typeinfo for patlib::symStrai
ght'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x24): undefined reference to `typeinfo for patlib::symLinear'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x30): undefined reference to `patlib::symLinear::~symLinear [i
n-charge]()'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x34): undefined reference to `patlib::symLinear::~symLinear [i
n-charge deleting]()'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x48): undefined reference to `patlib::symLinear::myBasLinear()
const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x64): undefined reference to `typeinfo for patlib::symLinear'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x68): undefined reference to `virtual thunk [v:0,-12] to patli
b::symLinear::~symLinear [in-charge]()'

[snip]

plus many more lines. this is under
gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)

from what i've found on the net `in-charge' refers to constructor, and `not-in-charge'
to a destructor. i've seen other people with errors like this, but they were all compiling other's code and had not included linker flags to the correct libraries. i don't think this is my problem, because it appears that i can link things correctly in subdirectories of this project. (oh, yes there are two subdirectories.) i can provide a tgz file with my code and makefile if necessary. any help appreciated!


thanks,


--shabbychef

what follows is my complete error message

----------------------------------------------------------------------
g++ -o test -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ test.o angle.o basedefs.o centered.o curve.o
dist.o dseg.o exceptions.o linear.o line.o obj.o point.o qbez.o quadratic.o quant.o radial.o ray.o straight.o transform.o ve
c.o circular.o circle.o geometric/geometric.o numeric/numeric.o -lplotter -lXaw -lXmu -lXt -lXext -lX11 -lm -lqt -lSM -lICE
-lc -lm -lz -lstdc++ -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/specs
Configured with: /var/tmp/portage/gcc-3.3.5.20050130-r1/work/gcc-3.3.5/configure --enable-version-specific-runtime-libs --pr
efix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3.5-20050130 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050
130/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.
3.5-20050130/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/info --with-gxx-include-dir=/usr/lib/gcc-lib
/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3 --host=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-
gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-l
ibgcj --enable-languages=c,c++,f77 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o
test /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/../../../crt1.o /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/..
/../../crti.o /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/crtbegin.o -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3
/lib -Lgeometric/ -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130 -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/..
/../../../i686-pc-linux-gnu/lib -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/../../.. test.o angle.o basedefs.o cente
red.o curve.o dist.o dseg.o exceptions.o linear.o line.o obj.o point.o qbez.o quadratic.o quant.o radial.o ray.o straight.o
transform.o vec.o circular.o circle.o geometric/geometric.o numeric/numeric.o -lplotter -lXaw -lXmu -lXt -lXext -lX11 -lqt -
lSM -lICE -lm -lz -lstdc++ -lstdc++ -lm -lc -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-2005013
0/crtend.o /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/../../../crtn.o
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symStraightE+0x24): undefined reference to `typeinfo for patlib::symStrai
ght'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symStraightE+0x4c): undefined reference to `patlib::symStraight::myBasStr
aight() const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symStraightE+0x68): undefined reference to `typeinfo for patlib::symStrai
ght'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x24): undefined reference to `typeinfo for patlib::symLinear'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x30): undefined reference to `patlib::symLinear::~symLinear [i
n-charge]()'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x34): undefined reference to `patlib::symLinear::~symLinear [i
n-charge deleting]()'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x48): undefined reference to `patlib::symLinear::myBasLinear()
const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x64): undefined reference to `typeinfo for patlib::symLinear'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x68): undefined reference to `virtual thunk [v:0,-12] to patli
b::symLinear::~symLinear [in-charge]()'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_9symLinearE+0x6c): undefined reference to `virtual thunk [v:0,-12] to patli
b::symLinear::~symLinear [in-charge deleting]()'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_12symQuadraticE+0x24): undefined reference to `typeinfo for patlib::symQuad
ratic'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_12symQuadraticE+0x44): undefined reference to `patlib::symQuadratic::myBasQ
uadratic() const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_12symQuadraticE+0x60): undefined reference to `typeinfo for patlib::symQuad
ratic'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE4_NS_10symFinpathE+0x8): undefined reference to `typeinfo for patlib::symFinpath
'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE4_NS_10symFinpathE+0x28): undefined reference to `patlib::symFinpath::myBasFinpa
th() const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE4_NS_10symFinpathE+0x44): undefined reference to `typeinfo for patlib::symFinpat
h'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE4_NS_8symCurveE+0x8): undefined reference to `typeinfo for patlib::symCurve'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE4_NS_8symCurveE+0x18): undefined reference to `patlib::symCurve::myBasCurve() co
nst'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE4_NS_8symCurveE+0x40): undefined reference to `typeinfo for patlib::symCurve'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symCenteredE+0x20): undefined reference to `typeinfo for patlib::symCente
red'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symCenteredE+0x28): undefined reference to `patlib::symCentered::myBasCen
tered() const'
dseg.o(.gnu.linkonce.r._ZTCN6patlib7symDsegE0_NS_11symCenteredE+0x58): undefined reference to `typeinfo for patlib::symCente
red'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD1Ev+0xa): In function `patlib::symQuadratic::~symQuadratic [in-charge]()':
/home/spav/private/patmak/CO/quadratic.h:66: undefined reference to `vtable for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD1Ev+0x19):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `vtable for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD1Ev+0x29):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `vtable for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD1Ev+0x3d):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `VTT for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD1Ev+0x4f):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD0Ev+0xa): In function `patlib::symQuadratic::~symQuadratic [in-charge deleti
ng]()':
/home/spav/private/patmak/CO/quadratic.h:66: undefined reference to `vtable for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD0Ev+0x19):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `vtable for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD0Ev+0x29):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `vtable for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD0Ev+0x3d):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `VTT for patlib::symQuadratic'
dseg.o(.gnu.linkonce.t._ZN6patlib12symQuadraticD0Ev+0x4f):/home/spav/private/patmak/CO/quadratic.h:66: undefined reference t
o `patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0xa): In function `patlib::symStraight::~symStraight [in-charge]()':
/home/spav/private/patmak/CO/straight.h:62: undefined reference to `vtable for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x19):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`vtable for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x29):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`vtable for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x31):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`VTT for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x43):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symLinear::~symLinear [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x5f):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`VTT for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x71):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x8a):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`VTT for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD1Ev+0x9c):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0xa): In function `patlib::symStraight::~symStraight [in-charge deleting]
()':
home/spav/private/patmak/CO/straight.h:62: undefined reference to `vtable for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x19):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`vtable for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x29):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`vtable for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x31):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`VTT for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x43):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symLinear::~symLinear [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x5f):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`VTT for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x71):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x8a):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`VTT for patlib::symStraight'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD0Ev+0x9c):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib8symCurveD0Ev+0xa): In function `patlib::symCurve::~symCurve [in-charge deleting]()':
/home/spav/private/patmak/CO/point.h:90: undefined reference to `vtable for patlib::symCurve'
dseg.o(.gnu.linkonce.t._ZN6patlib8symCurveD0Ev+0x19):/home/spav/private/patmak/CO/point.h:90: undefined reference to `vtable
for patlib::symCurve'
dseg.o(.gnu.linkonce.t._ZN6patlib8symCurveD1Ev+0xa): In function `patlib::symCurve::~symCurve [in-charge]()':
/home/spav/private/patmak/CO/point.h:90: undefined reference to `vtable for patlib::symCurve'
dseg.o(.gnu.linkonce.t._ZN6patlib8symCurveD1Ev+0x19):/home/spav/private/patmak/CO/point.h:90: undefined reference to `vtable
for patlib::symCurve'
dseg.o(.gnu.linkonce.t._ZN6patlib10symFinpathD0Ev+0xa): In function `patlib::symFinpath::~symFinpath [in-charge deleting]()'
:
/home/spav/private/patmak/CO/point.h:90: undefined reference to `vtable for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib10symFinpathD0Ev+0x19):/home/spav/private/patmak/CO/point.h:90: undefined reference to `vta
ble for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib10symFinpathD0Ev+0x21):/home/spav/private/patmak/CO/point.h:90: undefined reference to `VTT
for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib10symFinpathD1Ev+0xa): In function `patlib::symFinpath::~symFinpath [in-charge]()':
/home/spav/private/patmak/CO/point.h:90: undefined reference to `vtable for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib10symFinpathD1Ev+0x19):/home/spav/private/patmak/CO/point.h:90: undefined reference to `vta
ble for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib10symFinpathD1Ev+0x21):/home/spav/private/patmak/CO/point.h:90: undefined reference to `VTT
for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib7symDsegD1Ev+0xf2): In function `patlib::symDseg::~symDseg [in-charge]()':
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3/iostream:60: undefined reference to `patlib::symCentered::~
symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib7symDsegD1Ev+0x11d):/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3/iostre
am:60: undefined reference to `patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib7symDsegD0Ev+0xf2): In function `patlib::symDseg::~symDseg [in-charge deleting]()':
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3/iostream:60: undefined reference to `patlib::symCentered::~
symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib7symDsegD0Ev+0x11d):/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3/iostre
am:60: undefined reference to `patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.r._ZTIN6patlib7symDsegE+0x10): undefined reference to `typeinfo for patlib::symStraight'
dseg.o(.gnu.linkonce.r._ZTIN6patlib7symDsegE+0x18): undefined reference to `typeinfo for patlib::symFinpath'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD2Ev+0x51): In function `patlib::symStraight::~symStraight [not-in-charge]()':
/home/spav/private/patmak/CO/straight.h:62: undefined reference to `patlib::symLinear::~symLinear [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD2Ev+0x7d):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symCentered::~symCentered [not-in-charge]()'
dseg.o(.gnu.linkonce.t._ZN6patlib11symStraightD2Ev+0xa6):/home/spav/private/patmak/CO/straight.h:62: undefined reference to
`patlib::symCentered::~symCentered [not-in-charge]()'
line.o(.gnu.linkonce.r._ZTVN6patlib7symLineE+0x78): undefined reference to `patlib::symInfpath::myBasInfpath() const'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_11symStraightE+0x24): undefined reference to `typeinfo for patlib::symStrai
ght'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_11symStraightE+0x4c): undefined reference to `patlib::symStraight::myBasStr
aight() const'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_11symStraightE+0x68): undefined reference to `typeinfo for patlib::symStrai
ght'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x24): undefined reference to `typeinfo for patlib::symLinear'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x30): undefined reference to `patlib::symLinear::~symLinear [i
n-charge]()'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x34): undefined reference to `patlib::symLinear::~symLinear [i
n-charge deleting]()'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x48): undefined reference to `patlib::symLinear::myBasLinear()
const'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x64): undefined reference to `typeinfo for patlib::symLinear'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x68): undefined reference to `virtual thunk [v:0,-12] to patli
b::symLinear::~symLinear [in-charge]()'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_9symLinearE+0x6c): undefined reference to `virtual thunk [v:0,-12] to patli
b::symLinear::~symLinear [in-charge deleting]()'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_12symQuadraticE+0x24): undefined reference to `typeinfo for patlib::symQuad
ratic'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_12symQuadraticE+0x44): undefined reference to `patlib::symQuadratic::myBasQ
uadratic() const'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_12symQuadraticE+0x60): undefined reference to `typeinfo for patlib::symQuad
ratic'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE4_NS_10symInfpathE+0x8): undefined reference to `typeinfo for patlib::symInfpath
'line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE4_NS_10symInfpathE+0x28): undefined reference to `patlib::symInfpath::myBasInfpa
th() const'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE4_NS_10symInfpathE+0x44): undefined reference to `typeinfo for patlib::symInfpat
h'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE4_NS_8symCurveE+0x8): undefined reference to `typeinfo for patlib::symCurve'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE4_NS_8symCurveE+0x18): undefined reference to `patlib::symCurve::myBasCurve() co
nst'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE4_NS_8symCurveE+0x40): undefined reference to `typeinfo for patlib::symCurve'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_11symCenteredE+0x20): undefined reference to `typeinfo for patlib::symCente
red'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_11symCenteredE+0x28): undefined reference to `patlib::symCentered::myBasCen
tered() const'
line.o(.gnu.linkonce.r._ZTCN6patlib7symLineE0_NS_11symCenteredE+0x58): undefined reference to `typeinfo for patlib::symCente
red'
line.o(.gnu.linkonce.t._ZN6patlib10symInfpathD0Ev+0xa): In function `patlib::symInfpath::~symInfpath [in-charge deleting]()'
:
/home/spav/private/patmak/CO/line.h:78: undefined reference to `vtable for patlib::symInfpath'
line.o(.gnu.linkonce.t._ZN6patlib10symInfpathD0Ev+0x19):/home/spav/private/patmak/CO/line.h:78: undefined reference to `vtab
le for patlib::symInfpath'
line.o(.gnu.linkonce.t._ZN6patlib10symInfpathD0Ev+0x21):/home/spav/private/patmak/CO/line.h:78: undefined reference to `VTT
for patlib::symInfpath'
line.o(.gnu.linkonce.t._ZN6patlib10symInfpathD1Ev+0xa): In function `patlib::symInfpath::~symInfpath [in-charge]()':
/home/spav/private/patmak/CO/line.h:78: undefined reference to `vtable for patlib::symInfpath'
line.o(.gnu.linkonce.t._ZN6patlib10symInfpathD1Ev+0x19):/home/spav/private/patmak/CO/line.h:78: undefined reference to `vtab
le for patlib::symInfpath'
line.o(.gnu.linkonce.t._ZN6patlib10symInfpathD1Ev+0x21):/home/spav/private/patmak/CO/line.h:78: undefined reference to `VTT
for patlib::symInfpath'
line.o(.gnu.linkonce.t._ZN6patlib7symLineC1ERKS0_+0x171): In function `patlib::symLine::symLine[in-charge](patlib::symLine c
onst&)':
/home/spav/private/patmak/CO/line.cpp:56: undefined reference to `patlib::symCentered::~symCentered [not-in-charge]()'
line.o(.gnu.linkonce.t._ZN6patlib7symLineD0Ev+0xf2): In function `patlib::symLine::~symLine [in-charge deleting]()':
/home/spav/private/patmak/CO/line.cpp:56: undefined reference to `patlib::symCentered::~symCentered [not-in-charge]()'
line.o(.gnu.linkonce.t._ZN6patlib7symLineD0Ev+0x11d):/home/spav/private/patmak/CO/line.cpp:56: undefined reference to `patli
b::symCentered::~symCentered [not-in-charge]()'
line.o(.gnu.linkonce.t._ZN6patlib7symLineD1Ev+0xf2): In function `patlib::symLine::~symLine [in-charge]()':
/home/spav/private/patmak/CO/line.cpp:56: undefined reference to `patlib::symCentered::~symCentered [not-in-charge]()'
line.o(.gnu.linkonce.t._ZN6patlib7symLineD1Ev+0x11d):/home/spav/private/patmak/CO/line.cpp:56: undefined reference to `patli
b::symCentered::~symCentered [not-in-charge]()'
line.o(.gnu.linkonce.r._ZTIN6patlib7symLineE+0x10): undefined reference to `typeinfo for patlib::symStraight'
line.o(.gnu.linkonce.r._ZTIN6patlib7symLineE+0x18): undefined reference to `typeinfo for patlib::symInfpath'
point.o(.text+0x669): In function `patlib::symPoint::selfUpdate()':
/home/spav/private/patmak/CO/point.cpp:106: undefined reference to `typeinfo for patlib::symFinpath'
point.o(.gnu.linkonce.r._ZTVN6patlib8symPointE+0x10): undefined reference to `patlib::symCentered::myBasCentered() const'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_9symRadialE+0x8): undefined reference to `typeinfo for patlib::symRadial'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_9symRadialE+0x10): undefined reference to `patlib::symCentered::myBasCent
ered() const'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_9symRadialE+0x28): undefined reference to `patlib::symRadial::myBasRadial
() const'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_9symRadialE+0x4c): undefined reference to `typeinfo for patlib::symRadial
'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_11symCenteredE+0x8): undefined reference to `typeinfo for patlib::symCent
ered'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_11symCenteredE+0x10): undefined reference to `patlib::symCentered::myBasC
entered() const'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE0_NS_11symCenteredE+0x40): undefined reference to `typeinfo for patlib::symCen
tered'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE4_NS_10symFinpathE+0x8): undefined reference to `typeinfo for patlib::symFinpa
th'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE4_NS_10symFinpathE+0x28): undefined reference to `patlib::symFinpath::myBasFin
path() const'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE4_NS_10symFinpathE+0x44): undefined reference to `typeinfo for patlib::symFinp
ath'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE4_NS_8symCurveE+0x8): undefined reference to `typeinfo for patlib::symCurve'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE4_NS_8symCurveE+0x18): undefined reference to `patlib::symCurve::myBasCurve()
const'
point.o(.gnu.linkonce.r._ZTCN6patlib8symPointE4_NS_8symCurveE+0x40): undefined reference to `typeinfo for patlib::symCurve'
point.o(.gnu.linkonce.t._ZN6patlib9symRadialD1Ev+0xa): In function `patlib::symRadial::~symRadial [in-charge]()':
/home/spav/private/patmak/CO/radial.h:64: undefined reference to `vtable for patlib::symRadial'
point.o(.gnu.linkonce.t._ZN6patlib9symRadialD1Ev+0x19):/home/spav/private/patmak/CO/radial.h:64: undefined reference to `vta
ble for patlib::symRadial'

..... well, you get the idea...


Last edited by shabbychef; 09-02-2005 at 05:04 PM.
 
Old 09-02-2005, 05:02 PM   #2
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Are you compiling using g++ or gcc? If gcc, you should be using g++, which is the GNU C++ compiler. gcc is the C compiler and doesn't link any of the C++ libraries by default.
 
Old 09-02-2005, 05:06 PM   #3
shabbychef
LQ Newbie
 
Registered: Sep 2005
Distribution: gentoo
Posts: 4

Original Poster
Rep: Reputation: 0
i am using g++ to link

the command which attempts the link is

g++ -o test -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ test.o angle.o basedefs.o centered.o curve.o
dist.o dseg.o exceptions.o linear.o line.o obj.o point.o qbez.o quadratic.o quant.o radial.o ray.o straight.o transform.o ve
c.o circular.o circle.o geometric/geometric.o numeric/numeric.o -lplotter -lXaw -lXmu -lXt -lXext -lX11 -lm -lqt -lSM -lICE
-lc -lm -lz -lstdc++ -v

this is from my makefile. i use the same makefile stub in this dir and a subdir. i am able to get the subdir files compiled and executable. something else is going wrong here, i think....
 
Old 09-02-2005, 05:17 PM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Is g++ also used for the compilation of the objects or just the linker step? Maybe some sort of name mangling issue?
 
Old 09-09-2005, 04:04 PM   #5
shabbychef
LQ Newbie
 
Registered: Sep 2005
Distribution: gentoo
Posts: 4

Original Poster
Rep: Reputation: 0
g++ is used throughout the compilation process. here's a sample from make -n:


g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c qbez.cpp -o qbez.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c quadratic.cpp -o quadratic.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c quant.cpp -o quant.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c radial.cpp -o radial.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c ray.cpp -o ray.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c straight.cpp -o straight.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c transform.cpp -o transform.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c vec.cpp -o vec.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c circular.cpp -o circular.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c circle.cpp -o circle.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c geometric/geometric.cpp -o geometric/geometric.o
g++ -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ -I. -I/usr/qt/3/include -g -Wall -Wno-deprecated -c numeric/numeric.cpp -o numeric/numeric.o
g++ -o test -L/usr/local/lib -L. -L/usr/X11R6/lib -L/usr/qt/3/lib -Lgeometric/ test.o angle.o basedefs.o centered.o curve.odist.o dseg.o exceptions.o linear.o line.o obj.o point.o qbez.o quadratic.o quant.o radial.o ray.o straight.o transform.o vec.o circular.o circle.o geometric/geometric.o numeric/numeric.o -lplotter -lXaw -lXmu -lXt -lXext -lX11 -lm -lqt -lSM -lICE-lc -lm -lz -lstdc++ -v

and its still hosed. how do i find out more about `name-mangling'??


tia,
 
Old 09-09-2005, 06:57 PM   #6
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Name mangling is what C++ does to functions to support overloaded functions, etc. It's basically the reason you usually need to define functions compiled as see using extern "C".

If you are usgin g++ throughout, it isn't likely the problem, it was just something I was speculating on because I was out of any other ideas...

Is the patlib namespace your own, or is that from another library that you maybe aren't including in the linker parameters?

Last edited by deiussum; 09-09-2005 at 06:59 PM.
 
Old 09-09-2005, 07:16 PM   #7
shabbychef
LQ Newbie
 
Registered: Sep 2005
Distribution: gentoo
Posts: 4

Original Poster
Rep: Reputation: 0
patlib namespace is what i am developing. all of my stuff appears to be inside
this namespace.

i am wondering if there is some special flag i have to set for the compiler to know not
to mangle names so badly, or to be pedantic or something.

i also just emerged the latest and greatest gcc, so the problem may just go away
(i doubt it...)
 
Old 09-09-2005, 08:42 PM   #8
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Despite the way it sounds, "name-mangling" isn't really a bad thing. It just refers to the way a C++ compiler adds decorations to a function to uniquely identify it. About the only time it is a potential problem is when mixing C and C++. Since you are using a C++ compiler for each step, it shouldn't be a problem.

Are you using template classes at all? It doesn't appear so from the errors, but using templates can cause linker problems if you try to separate the implementation from the header like you usually do with normal classes. With templates, the compiler has to know the full implementation at the time it does each compilation unit, so you generally need to put the full implementation in the header.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
g++: inline functions can cause an undefined reference when linking? R00ts Programming 5 06-21-2005 03:13 AM
linking problems - 'undefined reference' errors back2morrie Programming 1 06-14-2005 08:02 AM
gcc ld error. Undefined reference redness Linux - Software 4 02-08-2005 02:01 AM
Linking own library: undefined reference to otosigo Programming 1 12-02-2004 08:05 AM
Undefined reference error using gcc with Redhat Linux 9.0 armesk Programming 2 08-28-2003 06:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration