A brutal fix …
… assuming that the class’es source code file is “MyClass.cxx”, execute: echo 'gROOT->LoadMacro("MyClass.cxx++"); gSystem->Exit(0);' | root -b -l -n
… or … root -b -l -n <<EOF
.L MyClass.cxx++
.q
EOF
This will (hopefully) create a “MyClass_cxx.so” shared library file (it should include the class’es dictionary and all “#pragma link C++” related ones as well). Add this “MyClass_cxx.so” shared library file (you can also rename it into something like a “libMyClass.so”, if you like) to the link command line instead of the “MyClass.o” file (no need to compile the “MyClass.cxx” file itself separately at all).
See also [url]Compile a macro without running? and [url]Peoblems with passing bash script arguments