OT (Linker problem with classes spreaded over directories)

Bjoern Krombholz bjkro at gmx.de
Fri Mar 10 12:58:57 GMT 2000


Thorsten Gecks wrote:
> 
> Hello this is my make output:
> 
[...]
> nnsimnormalunit.cpp:143: undefined reference to
> `NNSimConnection::NNSimConnection(NNSimParseObject &,
> NNSimAbstractUnit *, NNS imNetwork *,NNSimDoc *)'
[...]
> It the class nnsimconnection is in the directory abstractparsenodes, the
> class nnsimnormalunit in abstractparsenodes/units. nnsimnormalunit uses an
> instance of nnsimconnection, so it seems to me that the linker is trying
> to insert the constructor of nnsimnormalunit and doesn't find the
> constructor of nnsimconnection, that is neccessary for nnsimnormalunit to
> work. So obviously the linker doesn't look in all its supplied libraries,
> cause then it would find the constructor (i.e. when i would have placed
> anything from  abstractparsenodes/units in abstractparsenodes)
> 
> Is there a linker option or any code keyword, that solves this problem ?
> 

1.
#include "../nnsimconnection.h"

2.
If you already included the file, it could happen that declaration of
NNSimConnection is included behind definition of NNSimNormalUnit, so
you have to add:
class NNSimConnection;
to the top of nnsimnormalunit.h to show that there will follow a declaration
of NNSimConnection anywhere in the sources.

By the way, your question has no dependencies to kdevelop.
For C++ related questions it's the best to choose one of the numerous
news groups like de.comp.lang.iso-c++ (german).

Bjoern




More information about the KDevelop mailing list