Problem with TSelector!

Hi,

I am following this link to understand how TSelector work.
root.cern.ch/drupal/content/acc … -tselector

There is no problem till ‘Creating a Data Member’ title. Problem arises when EventSelector.h comes in play !

I don’t know how to link EventSelector.h and EventSelector.C files. I made one makefile and one main.C (See attached files) and linked them all but I am getting following error :

c++ -pthread -std=c++11 -Wno-deprecated-declarations -m64 -I/home/kdkulkarni93/products/root-6.02.08/include -c myselector.C c++ -pthread -std=c++11 -Wno-deprecated-declarations -m64 -I/home/kdkulkarni93/products/root-6.02.08/include -c main.C c++ myselector.o main.o -L/home/kdkulkarni93/products/root-6.02.08/lib -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -o main.x myselector.o: In function `myselector::IsA() const': myselector.C:(.text._ZNK10myselector3IsAEv[_ZNK10myselector3IsAEv]+0xd): undefined reference to `myselector::Class()' myselector.o: In function `myselector::ShowMembers(TMemberInspector&) const': myselector.C:(.text._ZNK10myselector11ShowMembersER16TMemberInspector[_ZNK10myselector11ShowMembersER16TMemberInspector]+0x11): undefined reference to `myselector::Class()' myselector.o:(.rodata._ZTV10myselector[_ZTV10myselector]+0x1d8): undefined reference to `myselector::Streamer(TBuffer&)' collect2: error: ld returned 1 exit status make: *** [main] Error 1

Please let me know if you can help. Thank you.

P.S. : I have done same thing for a different example having lot of files where makefile is undoubtedly necessary. Was getting the same error there.
myselector.h (4.37 KB)
myselector.C (3.36 KB)
main.C (364 Bytes)

I get:

$ g++ -o m main.C myselector.C `root-config --cflags --libs`
main.C:12:5: error: use of undeclared identifier 'EventTree'
    EventTree->Process("myselector.C");
    ^
1 error generated.

Hello,

Apart from the missing EventTree definition and load in the main program, causing Olivier error, the other errors indicate that there is a missing dictionary. So, either you comment out the ClassDef call in myselector.h, or you generate one (see attached tarball).

G Ganis
mymain.tgz (3.67 KB)