You are not logged in.

1

Friday, October 7th 2005, 5:39pm

Problem with ": : undefined reference to ..."

Hi, guys,
I write a program in Kdevelop, but i get some error message after compile.
--------------------------------------------------------------------------------
linking pants (libtool)
node.o(.text+0x2ef): In function `CNode::CNode[not-in-charge](long, double, double, double, CPattern, std::list<CNode*, std::allocator<CNode*> >*)':
: undefined reference to `CNoMobility::CNoMobility[in-charge](CNode*)'
node.o(.text+0x368): In function `CNode::CNode[not-in-charge](long, double, double, double, CPattern, std::list<CNode*, std::allocator<CNode*> >*)':
: undefined reference to `CRandDirBounce::CRandDirBounce[in-charge](CNode*)'
node.o(.text+0x3a1): In function `CNode::CNode[not-in-charge](long, double, double, double, CPattern, std::list<CNode*, std::allocator<CNode*> >*)':
: undefined reference to `CRandDirWrap::CRandDirWrap[in-charge](CNode*)'
node.o(.text+0x67f): In function `CNode::CNode[in-charge](long, double, double, double, CPattern, std::list<CNode*, std::allocator<CNode*> >*)':
: undefined reference to `CNoMobility::CNoMobility[in-charge](CNode*)'
node.o(.text+0x6f8): In function `CNode::CNode[in-charge](long, double, double, double, CPattern, std::list<CNode*, std::allocator<CNode*> >*)':
: undefined reference to `CRandDirBounce::CRandDirBounce[in-charge](CNode*)'
node.o(.text+0x731): In function `CNode::CNode[in-charge](long, double, double, double, CPattern, std::list<CNode*, std::allocator<CNode*> >*)':
: undefined reference to `CRandDirWrap::CRandDirWrap[in-charge](CNode*)'
collect2: ld returned 1 exit status
gmake: *** [pants] Error 1
gmake: Target `install' not remade because of errors.
*** Exited with status: 2 ***
---------------------------------------------------------------------------------------------
anyone know, how can i solve this?

thanks.

maju

Beginner

Posts: 1

Location: Poland

Occupation: qt/c++ programmer

  • Send private message

2

Wednesday, October 19th 2005, 7:30pm

Hi!
Basically undefined reference accures most often when the program cannot find .o files for the classes it is supposed to use.
It compiles without problems because it can see declarations, but when it's trying to link every thing it needs compiled 'library' with the body of the function.

In other words the file with CNoMobility etc. class was not compiled. It was included properly but not compiled.

Cheers!