Hi,
sorry for the slow reply! -p invokes the external preprocessor - all preprocessor macros will already be expanded when CINT sees your code. It will thus not be able to use it.
Instead, do not use -p, and instead use the following hack. Put in your
Linkdef.h:
extern const bool b1;
#pragma link C++ global b1;
This way, CINT will know that b1 is a variable. And you don't have to change the CCfits header files.
Cheers, Axel.
OKUMURA, Akira wrote:
> Hello ROOTers,
>
> '-p' option given to rootcint seems to prevent my code from using global
> macro. I wrote simple test codes which had some '#define' constants and
> compiled them using '-p' option of rootcint. I could not access such
> constants from interpreter but I could do it if I delete '-p'.
>
> However in my original code which was linked to CCFITS needs '-p'
> because a declaration of bool in its header cannot be handled by CINT
> correctly.
> (see http://root.cern.ch/root/roottalk/roottalk06/1562.html)
>
> Any suggestion?
>
> Sincerely
>
> OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
> Institute for Cosmic Ray Research, University of Tokyo
> 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan
> Phone/Fax : +81 4-7136-3153
> Skype : okumura.akira
>
> On 2007/05/23, at 5:00, OKUMURA, Akira wrote:
>
>> Hello ROOTers, >> >> I found an old post in roottalk. >> http://root.cern.ch/root/roottalk/roottalk98/2493.html >> I tried this but I still get 'Error: Symbol SHORT_IMG is ...'. >> >> I added >> #defined SHORT_IMG 16 >> in FITSfunction.h, and >> #pragma link C++ global SHORT_IMG; >> in FITSLinkDef.h . >> >> These two headers correspond to CERNfunction.h and CERNLinkDef.h >> (see http://root.cern.ch/root/HowtoCERNLIB.html) >> >> Sincerely >> >> OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp >> Institute for Cosmic Ray Research, University of Tokyo >> 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan >> Phone/Fax : +81 4-7136-3153 >> Skype : okumura.akira >> >> On 2007/05/22, at 17:44, OKUMURA, Akira wrote: >> >>> Hello ROOTers >>> >>> I compiled my original ROOT according to the web page >>> http://root.cern.ch/root/HowtoCERNLIB.html >>> It was compiled with the library CCfits (C++ FITS library). >>> >>> One of its headers has some #define lines such as >>> #define BYTE_IMG 8 >>> #define SHORT_IMG 16 >>> #define LONG_IMG 32 >>> >>> If I use these constants in my macro, I get an error. >>> root [0] .x test.C >>> Error: Symbol SHORT_IMG is not defined in current scope cookbook.C:114: >>> *** Interpreter error recovered *** >>> >>> but >>> root [0] .x test.C+ >>> runs as I expected. >>> >>> Is it possible to use #define constants of the library in my macro >>> without compiling? Is there any solution? >>> >>> Sincerely >>> >>> OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp >>> Institute for Cosmic Ray Research, University of Tokyo >>> 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan >>> Phone/Fax : +81 4-7136-3153 >>> Skype : okumura.akira >>> >>> >> >>
This archive was generated by hypermail 2.2.0 : Sat Jun 02 2007 - 11:50:01 CEST