LinkDef.h vs _linkdef.h

Hello,

I have found difference in the linkdef file
behaviour depending if this latter is named
as “XXXLLinkDef.h” or “XXX_linkdef.h” where
XXX is the name of the source file.
I attached a (small) example.
Just do :
root>.L SourceFiles.cxx+

compilation works fine.
Change then XXX_linkdef.h to XXXLinkDef.h
and recompile SoucrFiles.cxx,

I get the following output :

root [0] .L SourceFiles.cxx++
Info in TUnixSystem::ACLiC: creating shared library
/home/greder/boulot/code/cms/Dev/test/./SourceFiles_cxx.so
dlopen error: /home/greder/boulot/code/cms/Dev/test/./SourceFiles_cxx.so:
undefined symbol: _ZTV1A
Load Error: Failed to load Dynamic link library
/home/greder/boulot/code/cms/Dev/test/./SourceFiles_cxx.so
/usr/lib/gcc/i386-redhat-linux/4.0.0/…/…/…/crt1.o(.text+0x18): In
function _start': : undefined reference tomain’
/home/greder/boulot/code/cms/Dev/test/./fileNwiyTr.o(.text+0x24): In
function A::A()': fileNwiyTr.cxx: undefined reference tovtable for A’
/home/greder/boulot/code/cms/Dev/test/./fileNwiyTr.o(.text+0x5a): In
fileNwiyTr.cxx: undefined reference to vtable for A' /home/greder/boulot/code/cms/Dev/test/./fileNwiyTr.o(.text+0x5a): In functionA::A()’:
fileNwiyTr.cxx: undefined reference to vtable for A' /home/greder/boulot/code/cms/Dev/test/./fileNwiyTr.o(.text+0x90): In functionB::B()’:
fileNwiyTr.cxx: undefined reference to vtable for B' /home/greder/boulot/code/cms/Dev/test/./fileNwiyTr.o(.text+0xc6): In functionB::B()’:
fileNwiyTr.cxx: undefined reference to `vtable for B’
collect2: ld returned 1 exit status
*** Interpreter error recovered ***
root [1] .q

Could someone tell me if I misunderstood something ?

thanks, seb

ps :
[greder@localhost test]$ uname -a
Linux localhost.localdomain 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005
i686 i686 i386 GNU/Linux
[greder@localhost test]$ root-config --version
4.04/02b
[greder@localhost test]$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: …/configure --prefix=/usr --mandir=/usr/share/man
–infodir=/usr/share/info --enable-shared --enable-threads=posix
–enable-checking=release --with-system-zlib --enable-__cxa_atexit
–disable-libunwind-exceptions --enable-libgcj-multifile
–enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
–with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
–host=i386-redhat-linux
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)

@------------------------------------------@
Dr. Sebastien Greder, Imperial College
Office : (0044)-0207-594-1626
Fax : (0044)-0207-823-8830
imperial.ac.uk/research/hep/
@------------------------------------------@

Hi,

_linkdef.h is the default suffix expected by ACLiC to find the linkdef related to the file (Without this suffix, ACLiC can not know that the source file and the linkdef file are related). You can modify this suffix (See root.cern.ch/root/htmldoc//TSyst … kdefSuffix).

Alternatively (and problably better) you can simply embedded the pragma inside you header file:

#ifdef MAKECINT
#pragma link C++ myclass+;
#endif.