Preprocessor directive to stop including dependencies?

Hi there!
I’m trying to simulate my microcontroller’s behaviour in root. I.e., I’d like to load the original routines used for data evaluation by the MC into a root macro. So my code looks likesimulate_MC() { gROOT->ProcessLine(".x startup.c"); gSystem->Load("device_parameters_c.so"); gROOT->ProcessLine(".L device_parameters.c+"); (...) }with some finely-running script startup.c. Now the problem is that my code contains a lot of routines linked to lower-level hardware stuff which I’m not interested in currently. E.g., device_parameters.c starts off like#include <device_parameters.h> #include <ISL12025.h> (...)I do not want to go down all the dependency tree, so for simulating the data evaluation, I’d like not to include ISL12025.h. I tried to do so by preprocessor directives, but they seem to be ignored: modifying device_parameters.c (as inspired by Can’t call C++ code from Root macro) to[code]#include <device_parameters_PS.h>

#ifndef CINT
#include <ISL12025.h>
#endif
(…)[/code]still yields the same error as without the directives. Calling ‘root -l simulate_MC.c’ givesInfo in <TUnixSystem::ACLiC>: creating shared library (...)/./device_parameters_PS_c.so In file included from (...)/./filehCUXxn.h:32, from (...)/./filehCUXxn.cxx:16: (...)/./device_parameters_PS.c:19:22: error: ISL12025.h: No such file or directoryI also tried manually setting a define, but still got the same error: The macro looks likevoid simulate_MC() { #define __BUILD_FOR_ROOT gROOT->ProcessLine(".x startup.c"); gSystem->Load("device_parameters_c.so"); gROOT->ProcessLine(".L device_parameters.c+"); (...)with device_parameters.c looking like[code]#include <device_parameters_PS.h>

#ifndef __BUILD_FOR_ROOT
#include <ISL12025.h>
#endif
(…)[/code]with only one difference in the error message:Info in <TUnixSystem::ACLiC>: creating shared library (...)/./device_parameters_PS_c.so In file included from /tmp/rootcint_koLTdq.h:3, from /tmp/DwFlM4_cint.cxx:1: (...)/./device_parameters_PS.c:19:22: error: ISL12025.h: No such file or directory Error: external preprocessing failed. :0:What’s the ‘external preprocessing failed’ supposed to tell me?

Is there any other way to exclude libraries from building? This is root ROOT 5.18/00b (branches/v5-18-00-patches@22563 running on ubuntu (10.04, IIRC).
Best wishes,

Rufus

Hi Rufus,

When compiling with ACLiC both CINT and the compiler (usually g++) will process the code and so you must hide the code from both. The best means is indeed to use a #define, however #defining on the command line does not propagate it through ACLiC. There you need to do something like: gSystem->AddIncludePath("-D__BUILD_FOR_ROOT");

Cheers,
Philippe.