Rootcint -c -p

Dear Rooters,

I am extending some code which use the root class streaming capacity to save data, Since the project is heavy and complex I cannot give you directly the code, and the problem looks so strange that I am not sure that I can reproduce it with a small sample :imp:

After Adding my new class and it’s 2 daughter class (each as a cc file and a h file,ClassDef and Classimp are called) I Extend my Linkdef and try to compile, the Makefil calls rootcint so
rootcint -c Headerfiles… LinkDef.h

Error: class,struct,union or type MotherClass not defined  src/DaughterClass1.h
Error: class,struct,union or type MotherClass not defined  src/DaughterClass2.h
Error: link requested for unknown class MotherClass src/ProjectLinkDef.h
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation

According to this [url= topic[/url] the solution is to add a -p option
rootcint -c -p Headerfiles… LinkDef.h
I changed my Makefile to try that, and Magically it works.

However, I am not a fan of the idea of changing the compiling options in order to extend some code.

-Does someone know how I can manage to compile without this -p option ?

-If not can someone explain me what are the consequences of this option (using the C preprocessor to what I understood) and if it might change something to the final library coming out of that ?



The consequence of using -p are slightly slower run-time (of rootcint) and much better parsing of the header files (and possibly the inability to generate the dictionary for a macro itself).


Hi Philippe,
Thanks for the explanation,
By the way I understoof my problem since it can be of interest for other people
I was using a #warning at the start of the header to tell that it’s a working version of the class which should not be used for real work.
Simply by removing the #warning It compiles (and also by moving the #warming at the end of the file)

Looks like to be a strange behaviour of cint, keep it in the update list for the next version…

Any chance to squeeze the -p flag to ACLiC? I am including fftw3.h in one of my scripts and while compiling it through ACLiC the following error gets issued:

A bit later on the ACLiC suggests that:

[quote]Info in : The compiler has not found any problem with your macro.
Probably your macro uses something rootcint can’t parse.
Check for Cint’s limitations.

The fftw3.h has a huge precompiler macro that might trip the rootcint’s internal pre-compiler so I am guessing the -p flag would heal this problem.

Thanks for any input


Try: #ifndef __CINT__ #include "fftw3.h" #endif or: #ifdef __CINT__ typedef struct {char a[16];} __float128; /* 16 chars have the same size as one __float128 */ #endif #include "fftw3.h"
See also:

Tried. Better, but some spurious CINT messages printed below remain.

[quote]Info in TUnixSystem::ACLiC: creating shared library X/
X/FFTW_2D_C_ACLiC_dict.cxx: In function ‘void G__setup_memvar__float128()’:
X/FFTW_2D_C_ACLiC_dict.cxx:589:39: error: request for member ‘a’ in ‘* p’, which is of non-class type ‘__float128’
x86_64-pc-linux-gnu-g++: error: X/FFTW_2D_C_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!

Any ideas?

By the way - pedestrian compilation, that is (from bash, say)

#>rootcint -o X_dict.cxx -c -p X.h
#>g++ -o X_dict.o -c `root-config --cflags` X_dict.cxx

works fine. But I like ACLiC, too, so if there is a way to do it from root, I am all for it.




The difference between:rootcint -o X_dict.cxx -c -p X.hand what ACLiC does is that this command will request only the dictionary for the class named X which ACLiC will request the dictionary for all the symbol declared in X.h. One way to exactly emulated the command line above in ACLiC is to have a file// file name Xinclude.h #include "X.h" #ifdef __MAKECINT__ #pragma link C++ class X; // but you probably actually want: #pragma link C++ class X+; #endif and to pass Xinclude.h to ACLiC.


Hi all!

The best bet was using

#ifndef __CINT__
#include "fftw3.h"

and adding


so root finds all symbols.

Phillipe - I think I understand what you are saying, in that rootcint through ACLiC feels compelled to generate dictonary for __float128 even though it isn’t really neccesary whereas explicit rootcint command only generates dictionary for X and ignores __float128. Though I didn’t quite know how to pass Xinclude.h to ACLiC. Would that be through ?



[quote]Though I didn’t quite know how to pass Xinclude.h to ACLiC. Would that be through … ncludePath ? [/quote]No, you would pass it instead of the original header. For example instead of .L X.h+ you would do .L Xinclude.h+.