Rootcint and external variables in C

Hello all,

Maybe the gurus here know some solution for this problem…

I’m working on a c++ code and want to store a few classes in ROOT trees. I derive my classes from the TObject, create a dictionary with rootcint etc, that works fine.

I run into problems when trying to use a C library , which has a few external variables declared in header files like

Apparently rootcint can not find the implementation file where this variable is initialised.

rootcint -f cavityDict.cxx -c -I…/depend/tinyxml -I…/libbpm cavity.hh
Error: Symbol externlongbpm_rseed is not defined in current scope …/libbpm/bpm/bpm_nr.h:229:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing cavityDict.cxx cavityDict.h !!!
Error: rootcint: error loading headers…
make: *** [cavityDict.cxx] Error 1

Interestingly, the error occurs even if none of the class members uses any types or functions declared in the library, it’s enough to just include the header.

Use R__EXTERN instead of EXTERN

Rene

I guess that would be a solution if I was declaring external variables in my code, but I’m not. The EXTERN variables are defined in a separate purely C based pre-compiled library were any ROOT-specific/C++ code is not allowed. As soon as I include a header file from that library in my code, I get an error message, even if not using any functions/variables from it. Is it possible to forbid rootcint from checking out a particular header file, an equivalent of “//!”, as I don’t need ROOT to know about it?

in your header file, add the following;

#if !defined(__CINT__) #include "myproblematic_C.h" #endif
This will exclude the problematic include from rootcint

Rene