Adding function to root

I have a .C file with the function definition, evaluate function and analytical integral methods and a corresponding .h file. I added the header file to my macro and hoped this would be sufficient for it to be able to use the function in the file, but it seems I am missing a step. I run it and get errors like:

cling::DynamicLibraryManager::loadLibrary(): /path/toHPrime/DijetMassHPrime_C.so: undefined symbol: _ZTV22RooGaussDoubleSidedExp

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/…/…/…/…/lib64/crt1.o: In function `_start’:

(.text+0x20): undefined reference to `main’

Which I guess are maybe in some way related to the fact I haven’t made a .so file? What steps am I missing?

Sorry, I know this isn’t exactly a root question but I don’t know the keywords to google to get the answer, thanks for any help! :slight_smile:

What is you macro doing? This error:

cling::DynamicLibraryManager::loadLibrary(): /path/toHPrime/DijetMassHPrime_C.so: undefined symbol: _ZTV22RooGaussDoubleSidedExp

Means that the DijetMassHPrime_C macro has been compiled and needs RooGaussDoubleSidedExp, which is not found.

1 Like

The macro is trying to use the function to fit some pseudo data. I don’t know how to make it find and recognise the contents of the function.C file, I thought adding the function .h file to my fitting macro would do the trick but I must be missing a step. Or a few steps. Do I need to load the function.C file from the root command line or something before I run the fitting macro that will use it?

It depends on what is in your .h file and what is in your .C file, and what makes /path/toHPrime/DijetMassHPrime_C.so auto-loading…

My function.C file is laid out like a standard roofit function in the library.

I didn’t do anything to compile or link either of them other than adding the header file to the fitting macro, then running fitting.C+g.

Please provide something we can try, there is not much we can do by just guessing…

try first “.L function.C++” and then “.x fitting.C++g.

2 Likes

That’s worked, it’s running! Thank you! :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.