How to compile a C file in root with my own class?

I wrote my own class, eg MyEvent, and after compilation I got MyEvent.so.
I CAN load MyEvent.so and run my Fit.C File in root correctly,
but my friend told me that if I compile the C File, it’ll run faster. so I modified C file, instead
load MyEvent.so, I include all the head file I need. then I tried:

.L Fit.C+
Info in TUnixSystem::ACLiC: creating shared library /home/data/Analysis/./Fit_C.so
dlopen error: /home/data/Analysis/./Fit_C.so: undefined symbol: _ZTV9VolumePar

VolumePar is another my class which is called by MyEvent.

then I try to include the LinkDef.h, here is what I got:

.L Fit.C+
Info in TUnixSystem::ACLiC: creating shared library /home/data/Analysis/./Fit_C.so
Error: link requested for unknown class MyGeometry FILE:/home/LinkDef.h LINE:6
Error: link requested for unknown class VolumePar FILE:/home/LinkDef.h LINE:7
Error: link requested for unknown class MyEvent FILE:/home/LinkDef.h LINE:8
Error: link requested for unknown class MyEventData FILE:/home/LinkDef.h LINE:9

what should I do?

Hi,
include the headers, otherwise the classes in your LinkDef are unknown. It would be better if you built your “other classes” into a .so, too. You can do that by building one .so for each class (don’t forget to remove these classes from Fit.C’s linkdef!), or by putting all these classes in one LinkDef.h, and #including their sources (!) in one common source file, which you then compile (".L includes_all_sources.C+").
Axel.