My macro does not work

Hello , I’m a beginner user and I’m learning use root . After very problems with installation I finally build root 6.06.04.

My SO Ubuntu 16,

gcc and g++ compiler version 4.8

but it still having problems. I’m trying to run a macro with .x command but it shows the message error below:

root [0] .x platonagem_juan.c
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:18:1: error: unknown type
name ‘ler’
ler.open(“dados06.txt”);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:18:4: error: cannot use
dot operator on a type
ler.open(“dados06.txt”);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:21:1: error: expected
unqualified-id
if(!ler.is_open()){
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:25:2: error: expected
unqualified-id
}else{
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:36:1: error: expected
unqualified-id
while(!ler.eof()){
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:46:1: error: unknown type
name ‘gStyle’
gStyle->SetOptStat(0);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:46:7: error: cannot use
arrow operator on a type
gStyle->SetOptStat(0);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:51:1: error: unknown type
name ‘canvas’
canvas->SetLogy();
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:51:7: error: cannot use
arrow operator on a type
canvas->SetLogy();
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:53:1: error: unknown type
name ‘canvas’
canvas->SetGridx();
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:53:7: error: cannot use
arrow operator on a type
canvas->SetGridx();
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:55:1: error: unknown type
name ‘canvas’
canvas->SetGridy();
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:55:7: error: cannot use
arrow operator on a type
canvas->SetGridy();
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:59:1: error: unknown type
name ‘ntuple’
ntuple->Draw(“c:HV>>h1”,“limiar==10”,“prof”);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:59:7: error: cannot use
arrow operator on a type
ntuple->Draw(“c:HV>>h1”,“limiar==10”,“prof”);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:61:1: error: unknown type
name ‘h1’
h1->SetMarkerStyle(20);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:61:3: error: cannot use
arrow operator on a type
h1->SetMarkerStyle(20);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:63:1: error: unknown type
name ‘h1’
h1->SetMarkerColor(2);
^
/home/juan/Downloads/Cintilador 6/./platonagem_juan.c:63:3: error: cannot use
arrow operator on a type
h1->SetMarkerColor(2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
root [1]

the same macro work perfectly at root 5. I really don’t know how to fix this problem :frowning:

Macro file is Attached bellow
dados06.txt (4.36 KB)
platonagem_juan.c (1.23 KB)

An improved version.
platonagem_juan.cxx (1.8 KB)

Thank you !!! :slight_smile:

Can you explain why it happens? Because it used work in a older version installed .

why do I have to use gDirectory? I didn’t use to need .