linking problem with subdirectoried

Marko Mikulicic mmikulicic at
Wed Jul 21 22:18:52 UTC 1999

I'm new to the list but I was using kdevelop for a while.
I'm writing a project using kdevelop and when it became
very big I decided to move parts of it into subdirectories.
I created a new project and imported files from the old one.
Kdevelop generated the makefiles in the subdirs.
  I started the build and all the files compiled fine,
generating a static library in every dir.
In the link phase I got the "undefined reference" to constructors
and destructors of some classes. I think it's because
those classes are defined in other archives.
The errors are only about symbols from the archived object files
not for the classes define in the toplevel directory of the
  I don't know if the problem is caused by kdevelop and it's
generated makefiles.
I'm using linux for several years but never went deeply in the
linking process, always letting the automation do the yob.
 I tried to create a simplified project and tried to simulate the
problem creating three classes in three subdirectories, one
being the subclass of the second and instantiating the third, 
while the third instantiated the second in the constructor, thus
creating a crossreference. But this thing compiles and links well!
I tried with nm to list the simbols defined in the archives of my
project and the symbols claimed to be undefined where correctly displayed
as defined.
I tried to use the linker option -Wl,--whole-archive
but I got the following error:
/usr/bin/ld: internal error ldlang.c 3088
I suspect this is the solution because it obeys the Murphy's law :-)
(I use binutils, didn't found newer)
Ah, exchanging the position of two static libraries in the linking commandline
I get different error messages.
Sorry for asking a question not strictly inherent to kdevelop but
I think that some of you has experience with the build process.
Thanks in advance,

More information about the KDevelop mailing list