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
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=https://root-forum.cern.ch/t/error-class-struct-union-or-type-not-defined/8430/1 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 root.cern.ch/viewvc/trunk/cint/doc/limitati.txt for Cint’s limitations.
[/quote]
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.
Tried. Better, but some spurious CINT messages printed below remain.
[quote]Info in TUnixSystem::ACLiC: creating shared library X/FFTW_2D_C.so
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!
[/quote]
Any ideas?
By the way - pedestrian compilation, that is (from bash, say)
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.
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 http://root.cern.ch/root/html/TSystem.html#TSystem:AddIncludePath ?
[quote]Though I didn’t quite know how to pass Xinclude.h to ACLiC. Would that be through root.cern.ch/root/html/TSystem.h … 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+.