Errors recovering

Hi. I’ve installed the last version of ROOT on my Macbook with OSx El Capitan.
Generally, when I ran a macro, the interpreter was able to find the errors, and it was able to recover them, showing interpreter errors recovered.
Now, on this build, this is no longer possible, but I don’t understand the reasons.
I’ve just try to rebuild root other times, but without results :frowning:
Can someone help me???

Hi,
Could you show us the macro you run (possibly reduced as much as possible) and the failure you see?
Cheers,
Vassil

I’ve a lot of pre-written macros for the data analisis course at university, and if I wanted to correct all the macros I’d finish the next year :laughing:


However, one of the example is the string:

void main(TString date, TString extens, TString muonType, TString par, TString par2, TString par3, TString scale, TString err)

with the error:

In file included from input_line_9:1:
/Users/PIWY/Desktop/ESRCITAZIONI ANALISI DATI/esercitazione-1/step0/main.c:26:1: error:
‘main’ must return 'int’
void main(TString date, TString extens, TString muonType, TString par, T…
^~~~
int
/Users/PIWY/Desktop/ESRCITAZIONI ANALISI DATI/esercitazione-1/step0/main.c:26:6: error:
too many parameters (8) for ‘main’: must be 0, 2, or 3
void main(TString date, TString extens, TString muonType, TString par, T…
^
/Users/PIWY/Desktop/ESRCITAZIONI ANALISI DATI/esercitazione-1/step0/main.c:26:6: error:
first parameter of ‘main’ (argument count) must be of type ‘int’
/Users/PIWY/Desktop/ESRCITAZIONI ANALISI DATI/esercitazione-1/step0/main.c:26:6: error:
second parameter of ‘main’ (argument array) must be of type ‘char **’
/Users/PIWY/Desktop/ESRCITAZIONI ANALISI DATI/esercitazione-1/step0/main.c:26:6: error:
third parameter of ‘main’ (environment) must be of type ‘char **’


I know I can correct all the errors (even though I’m a beginner, so it’s very difficult for me!), but the auto-detection and recovery of the errors is very useful for me, and I won’t give that up.

I thought there is a sort of “tool” of the cling interpreter that perhaps does not working now.
So, how I can “activate” this “tool”? :frowning:

Thanks so much, and happy new year! :slight_smile:

Giuseppe

Hi Giuseppe,
Can you show me the way you use those files. Do you start ROOT and run .L or .x and so on.

At first look, those errors seem valid to me. I’d suggest fixing them. Please rename the routine called ‘main’ because it is reserved by ROOT in ROOT’s newer versions.
–Vassil

PS: Cling/ROOT cannot fix the errors for you. It can only suggest a few things which may or may not be relevant to help you fix the error.

Using the Osx terminal, I go in the directory where “main.c” stay. Then I start ROOT and run “.x main.c”.

The same procedure works fine on Scientific Linux: I see the message interpreter errors recovered and the macro perfectly runs!

Cling/ROOT cannot fix the errors for me, but why on SL it works but not on my macbook?
I don’t want to give up this useful tool in the knowledge that a solution exists and on other platforms works fine! :frowning:

[P.S: I’m a young italian student, so you’ll forgive me if my english is often bad #-o ]

I assume on SLC you have ROOT 5 series and on your laptop you have ROOT 6. ROOT 6 is much more strict wrt to C++ and thus the difference. Could you check?

main” is a special name which you should not use.
Rename your “main” into something else (like “mymain”, for example).
Also, as this is a c++ code, use a “.cxx” file extension instead of “.c”.

Hi Pepe Le Pew. I’ve just try your solution some day ago (I found it in an other forum), but it doesn’t work.

Vassil…now it works fine!!! Thank you!!! I’ve built the 5.34 version and it works!

I’ve noticed launching ROOT that 5.34 version for mac uses Cint as interpreter, while the 6.06 uses cling.
On SL the 6.06 ROOT version still use Cint, so…is it likely there are some problems in cling for mac?

Well,
I wish I can continue to use 5.34 version in the future with the xcode/OSx updates!
I wish this problem of new versions for mac users works out in the future!

Once again thank you, Vassil! :smiley:

Cheers,
Giuseppe

The errors that you show in your second post here are strictly related to improper “main”.
If, after fixing the “main” problem, you got another errors then it means they are still there.
Try to [url=https://root-forum.cern.ch/t/error-symbol-not-defined-in-current-scope/14650/2 your source code using ACLiC[/url] (the compiler will find many possible source code bugs) … root [0] .L MySourceCode.cxx++

Hi Giuseppe,

Please pay the price to fix your code once. CINT might run it without complaints, but it might misunderstand your code, giving wrong results. There is no replacement for proper code. Please do what Pepe suggests, including the change of file extension.

ROOT 5.34 is discontinued; there will be no updates to future OS versions.

All of ROOT 6 uses cling, all releases of ROOT 5 use CINT as interpreter. No matter what platform you’re running on.

Cheers, Axel.