Re: new classes

From: Mario Kadastik <mario.kadastik_at_cern.ch>
Date: Sun, 2 Jul 2006 17:34:26 +0300


Hello Michael,

thanks for the list, but you assume that MyEvent.h only contains one class MyEvent. Now as mine contains three: MyParticle, MyMET and MyEvent, then the default linkdef what it creates doesn't work :P

rootcint -f particles_dict.cpp -c -I$PWD particles.h Error: link requested for unknown class particles G__auto13439LinkDef.h:7:
Warning: Error occurred during reading source files Warning: Error occurred during dictionary source generation !!!Removing particles_dict.cpp particles_dict.h !!! Error: rootcint: error loading headers...

that's why I went for the ACLiC use :)

But thanks for the list anyway, when I have just one class per file then it comes of use for sure :)

Mario

On Jul 2, 2006, at 5:21 PM, mgericke_at_jlab.org wrote:

> Hi Mario,
>
> Here is what I usually have to do when compiling a standalone root
> executable with g++:
>
> 1) (This one generates the dictionaries)
>
> rootcint -f MyEventDict.cpp -c -I{your_root_include_dir} MyEvent.h
>
> 2)
>
> g++ -Wno-deprecated -c -O -Wall -fPIC `root-config --cflags`
> -I{your_root_include_dir} MyEventDict.cpp
>
> 3)
>
> g++ -Wno-deprecated -c -O -Wall -fPIC `root-config --cflags`
> -I{your_root_include_dir} MyEvent.cpp
>
> 4)
>
> g++ -o libparticles.so -shared -rdynamic -O -Wall -fPIC MyEvent.cpp
> MyEventDict.cpp `root-config --cflags --libs --glibs`
>
> 5)
>
> g++ -O MyEventDict.o -L/usr/X11R6/lib `root-config --glibs --cflags
> --libs` /home/mario/pythia/test/libparticles.so -o test
>
>
> So, from what I can tell all you were missing is to generate the
> dictionaries as shown above and then compiling them into your
> library too.
>
> Hope this helps,
>
> Michael
>
>
>
>>
>> [oberon] /home/mario/pythia/test > g++ -o libparticles.so -shared -
>> rdynamic -O -Wall -fPIC MyEvent.cpp `root-config --cflags --libs --
>> glibs`
>> [oberon] /home/mario/pythia/test > g++ -o test test.cpp `root-config
>> --cflags --libs --glibs` -L$PWD -lparticles/home/mario/pythia/test/
>> libparticles.so: undefined reference to `vtable for MyEvent'
>> /home/mario/pythia/test/libparticles.so: undefined reference to
>> `ROOT::GenerateInitInstance(MyEvent const*)'
>> collect2: ld returned 1 exit status
>>
>> what am I doing wrong? I really need just a basic class with some
>> objects to use in trees. The trouble is there is no simple example I
>> could reference ...
>>
>> --------------------------------
>> Mario Kadastik
>> CMS experiment
>> mario.kadastik_at_cern.ch
>>
>> "Physics is like sex, sure it may give some practical results, but
>> that's not why we do it"
>> --- Richard P. Feynman
>>
>>
>>
>
>



Mario Kadastik
CMS experiment
mario.kadastik_at_cern.ch

"Physics is like sex, sure it may give some practical results, but that's not why we do it"

Received on Sun Jul 02 2006 - 16:34:39 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:59 MET