I am trying to compile a macro which includes a ‘third-party’ header file. The header file requires some pre-processor commands that are usually set when invoking the compiler using the -D option (eg -D_SOMEOPTION)
Is there a way to set this when compiling with ACLiC?
you can “hack” it into ACLiC using TSystem::GetMakeSharedLib() and TSystem::SetMakeSharedLib(). You call Set… with the value returned by Get…, and replace “$IncludePath” by “$IncludePath -D_SOMEOPTION”.
root [3] .L myMacro.C++Info in TUnixSystem::ACLiC: creating shared library /Users/peter/code/testCode/./myMacro_C.soIn file included from /Users/peter/code/testCode/./myMacro.C:1, from /var/tmp//rootcint_4Lducu.h:3,
from /var/tmp/tmp.0.23w51G_cint.cxx:1:
/Users/peter/code/testCode/./myHeader.h:2:2: error: #error SOME COMMAND MUST BE SET
Error: external preprocessing failed. :0:
My root version is 5.27/01 on OSX 10.6.4 running gcc 4.2.1
To complete add a macro declaration to ACLiC use:gSystem->AddIncludePath(" -D__SOME_COMMAND ");When using SetMakeSharedLib the declaration is only passed to the compiler and not to rootcint which with AddIncludePath it is passed on to both.