Compiling kdevelop - undefined reference to .... problems

Ralf Habacker ralf.habacker at freenet.de
Mon Apr 5 23:12:03 CEST 2004


On Monday 05 April 2004 18:13, Sean Kelly wrote:
> Quoting Ralf Habacker <ralf.habacker at freenet.de>:
> > > .libs/kmdimainfrm.o(.text+0xe6e):kmdimainfrm.cpp: undefined reference
> > > to `KMainWindow::menuBar()'
> >
> > try
> > make LIBS="-lkdeui -lkdecore -ldcop -lqt-mt -lXext -lX11 -lICE -lSM"
> >
> > The class is defined in the kdeui library.
>
> Thanks, that worked.  I am now failing in kdevelop-3.0.2/languages/fortran
> with an undefined reference to
> FtnchekConfigWidgetBase::FtnchekConfigWidgetBase.
>
> I once more tried adding -lqui to the LIBS statement with no success.  I
> also tried running nm against the libs in /opt/qt/3.2/libs, /opt/kde3/libs
> and /usr/lib but couldn't see FtnchekConfigWidgetBase mentioned in the
> output.  I also couldn't find anything on the mailing list about this
> problem and a web search for FtnchekConfigWidgetBase brought back a couple
> of pages but they didn't mention the library they could be found in.

a google search gives me 
http://www.kdevelop.org/3.0/doc/programming_manual/html/classFtnchekConfigWidgetBase.html

and a look into languages/fortran shows, that there there are two files 
ftnchekconfigwidgetbase.cpp and ftnchekconfigwidgetbase.h, which implements 
this class. At first I assume that the object file 
nm  .libs/ftnchekconfigwidgetbase.o created from ftnchekconfigwidgetbase.cpp 
is damaged or empty. an nm shows me 

$ cd languages/fortran
$ nm  .libs/ftnchekconfigwidgetbase.o | grep 
FtnchekConfigWidgetBase::FtnchekConfigWidgetBase
<empty line> 

Please note the empty output of this tool. It does not print  
FtnchekConfigWidgetBase::FtnchekConfigWidgetBase as you may expect. 

The constructors you are missing are coded as 
000018d0 T __ZN23FtnchekConfigWidgetBaseC1EP7QWidgetPKcj
                            <----method name------> <method signature>
00000230 T __ZN23FtnchekConfigWidgetBaseC2EP7QWidgetPKcj
                            <----method name------> <method signature>

This behavior, coding the c++ method with the parameter list into a some sort 
of cryptic symbols is called name mangling, which all c++ compilers does. 
You can get a more readable output with: 

$ nm  -C .libs/ftnchekconfigwidgetbase.o | grep 
FtnchekConfigWidgetBase::FtnchekConfigWidgetBase
000018d0 T FtnchekConfigWidgetBase::FtnchekConfigWidgetBase(QWidget*, char 
const*, unsigned)
00000230 T FtnchekConfigWidgetBase::FtnchekConfigWidgetBase(QWidget*, char 
const*, unsigned)

so If you look fot c++ symbols either use only symbol method names or use nm 
-C. 

Ralf 



More information about the kde-cygwin mailing list