Error when importing header : Symbol constchar is not defined in current scope

Hello dear rescuers,

I’m using ROOT 5.34 and trying to load a C++ function with PyUranie but it seems that the C++ interpreter fails to load the XML Parser header.

When executing : .L tinyxml2.h I get the following errors

Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Illegal pointer operation (tovalue) tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Illegal pointer operation (tovalue) tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Illegal pointer operation (tovalue) tinyxml2.h:619:
Error: Symbol ;} is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol ;returnp;}staticchar is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Symbol charp is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: G__getvariable: expression tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: Symbol {returntrue;}returnch is not defined in current scope tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: G__getvariable: expression tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: Symbol ch is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol q is not defined in current scope tinyxml2.h:619:
Warning: Automatic variable intnChar is allocated tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol q is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol q is not defined in current scope tinyxml2.h:619:
Error: Symbol nChar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol q is not defined in current scope tinyxml2.h:619:
Error: Symbol nChar is not defined in current scope tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: unexpected character in expression 0;}inlinestaticboolIsUTF8Continuation(charp tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Syntax Error: !=0;}staticconstchar tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol bool is not defined in current scope tinyxml2.h:619:
Error: Symbol hasBOM is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol bool is not defined in current scope tinyxml2.h:619:
Error: Symbol hasBOM is not defined in current scope tinyxml2.h:619:
Error: Symbol bool is not defined in current scope tinyxml2.h:619:
Error: Symbol hasBOM is not defined in current scope tinyxml2.h:619:
Error: Symbol ;staticconstchar is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol length is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol length is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol length is not defined in current scope tinyxml2.h:619:
Error: Symbol unsignedlonginput is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol output is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol length is not defined in current scope tinyxml2.h:619:
Error: Symbol intv is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol buffer is not defined in current scope tinyxml2.h:619:
Error: Symbol intbufferSize is not defined in current scope tinyxml2.h:619:
Error: Symbol unsignedv is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol buffer is not defined in current scope tinyxml2.h:619:
Error: Symbol intbufferSize is not defined in current scope tinyxml2.h:619:
Error: Symbol boolv is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol buffer is not defined in current scope tinyxml2.h:619:
Error: Symbol intbufferSize is not defined in current scope tinyxml2.h:619:
Error: Symbol floatv is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol buffer is not defined in current scope tinyxml2.h:619:
Error: Symbol intbufferSize is not defined in current scope tinyxml2.h:619:
Error: Symbol doublev is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol buffer is not defined in current scope tinyxml2.h:619:
Error: Symbol intbufferSize is not defined in current scope tinyxml2.h:619:
Error: Symbol int64_tv is not defined in current scope tinyxml2.h:619:
Error: Symbol char is not defined in current scope tinyxml2.h:619:
Error: Symbol buffer is not defined in current scope tinyxml2.h:619:
Error: Symbol intbufferSize is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol str is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol str is not defined in current scope tinyxml2.h:619:
Error: Symbol unsigned is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol str is not defined in current scope tinyxml2.h:619:
Error: Symbol bool is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol str is not defined in current scope tinyxml2.h:619:
Error: Symbol float is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol str is not defined in current scope tinyxml2.h:619:
Error: Symbol double is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol str is not defined in current scope tinyxml2.h:619:
Error: Symbol int64_t is not defined in current scope tinyxml2.h:619:
Error: Symbol value is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol writeTrue is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol writeFalse is not defined in current scope tinyxml2.h:619:
Error: Symbol ;private:staticconstchar is not defined in current scope tinyxml2.h:619:
Error: Symbol writeBoolTrue;staticconstchar is not defined in current scope tinyxml2.h:619:
Error: Symbol writeBoolFalse;} is not defined in current scope tinyxml2.h:619:
Error: Symbol constchar is not defined in current scope tinyxml2.h:619:
Error: Symbol p is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: Symbol int is not defined in current scope tinyxml2.h:619:
Error: Symbol curLineNumPtr is not defined in current scope tinyxml2.h:619:
Error: improper lvalue tinyxml2.h:619:
*** Interpreter error recovered ***

It seems that when I delete the macro at the class declaration (line 530), it solves the problem which then reappears at the next class declaration with the same macro. I then keep deleting this macro each time which seems to solve the problem.
If I directly replace the macro by its value in my configuration : __attribute__((visibility("default"))), it causes the same problem.

Is there a missing feature in the interpreter ?

Thanks for any help or answer.

tinyxml2.h (66.2 KB)

I just tried what to load this header on my machine.

With ROOT 5 I get

$ root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.34/37      6 April 2016   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.34/37 (heads/v5-34-00-patches@v5-34-36-1-g4008982, Mar 17 2017, 11:33:00 on macosx64)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L tinyxml2.h
Error: Invalid type 'denorm' in declaration of 'present' /Users/couet/git/root534-cocoa-bin/cint/cint/stl/_climits.h:32:
*** Interpreter error recovered ***
root [1] .q

With ROOT 6 I get:

$ root
   ----------------------------------------------------------------
  | Welcome to ROOT 6.09/03                    http://root.cern.ch |
  |                                   (c) 1995-2016, The ROOT Team |
  | Built for macosx64                                             |
  | From heads/master@v6-09-02-145-ge1b7ca7, Mar 20 2017, 10:26:53 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'     |
   ----------------------------------------------------------------

root [0] .L tinyxml2.h
root [1] 

I am on Mac

Indeed - ROOT 5 understands most C++ and misunderstands some. You’ll have to hide parts that are too difficult for CINT (#ifndef __CINT__).

ROOT 6 just works. Time to switch, maybe?

Cheers, Axel.

Thank you both for your answers.

I’m working with a software using ROOT 5 so I’ll have to wait for them to switch to ROOT 6.
In the time being I’ll follow your advice Axel.

Thanks again.

Hi again,

I’ve tried your solution Axel but it turns out that CINT generates more errors than the gcc compile with the option ‘std=c++03’ so it is quite hard to make the full code compatible with it.

So I thought of a workaround, like an implementation of the pimpl idiom pattern.
Like recommended in this thread : Rootcint && C++11.

But i’m wondering about compatibility between my compilers with which I will generate the library and the compiler or interpreter CINT.
This thread is implying that it should be fine :http://softwareengineering.stackexchange.com/questions/162408/can-a-compiled-c11-library-lib-dll-etc-be-linked-in-older-c-compilers.
But I’ve also seen some post saying the contrary, presenting the C++ ABI as being the problem?

So I would like some advice. Is it a good workaround and if so, is there a best way to implement it?

Thanks for any effort.
Valentin

Hi,

I don’t really know how to help:

You have code that is too complex for CINT. You can hide it, either using #ifndef __CINT__ or indeed by hiding the library header from your header. I don’t see where ABI compatibility would become an issue here.

But these are all just workarounds. The only proper solution is to move to ROOT 6. It’s a new major version adopted by virtually all experiments for a reason. Do yourself a favor and ask the people maintaining your software to move. Asking for help with ROOT 5’s limitations is fairly unproductive for us, too…

Cheers, Axel