Root LoadMacro

Good morning,
i’ve got a serious problem loading a macro in root.
I’ve a virtual machine with Ubuntu 14.04.02 on it and the last version of ROOT (6.04).
I’ve written a macro in a generic folder. When i open root in that folder and do the command gRoot->LoadMacro(“diff.cxx++g”), i receive these errors:

[code]root [0] gROOT->LoadMacro("./diff.cxx++g")
Info in TUnixSystem::ACLiC: creating shared library /home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/././diff_cxx.so
In file included from /home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:16:0:
/home/physycom/Root/include/TInterpreter.h:329:7: error: stray ‘\303’ in program
R__LOCKGUARD2(gInterpreterMutex);
^
/home/physycom/Root/include/TInterpreter.h:329:7: error: stray ‘\240’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\303’ in program
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\240’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\303’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\240’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\303’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\240’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\303’ in program
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:4: error: stray ‘\240’ in program
In file included from /home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:13:0:
/home/physycom/Root/include/TInterpreter.h: In member function ‘void TInterpreter::CallFunc_SetArguments(CallFunc_t*, const T& …)’:
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:3:61: error: expected initializer before ‘dILaboratoriosP2dIFacoltativodIDiffsPSmorzatodIdOdIdiff_cxx_ACLiC_dictR__guard329’
#define R__DICTIONARY_FILENAME dIhomedIphysycomdIUniversitàdILaboratoriosP2dIFacoltativodIDiffsPSmorzatodIdOdIdiff_cxx_ACLiC_dict
^
/home/physycom/Root/include/RConfig.h:401:39: note: in definition of macro ‘NAME3

define NAME3(name1,name2,name3) name1##name2##name3

                                   ^

/home/physycom/Root/include/RConfig.h:421:27: note: in expansion of macro ‘R__JOIN3

define R__UNIQUE(X) R__JOIN3(R__DICTIONARY_FILENAME,X,LINE)

                       ^

/home/physycom/Root/include/RConfig.h:421:38: note: in expansion of macro ‘R__DICTIONARY_FILENAME’

define R__UNIQUE(X) R__JOIN3(R__DICTIONARY_FILENAME,X,LINE)

                                  ^

/home/physycom/Root/include/TVirtualMutex.h:94:40: note: in expansion of macro ‘R__UNIQUE
#define R__LOCKGUARD(mutex) TLockGuard R__UNIQUE(R__guard)(mutex)
^
/home/physycom/Root/include/TVirtualMutex.h:102:4: note: in expansion of macro ‘R__LOCKGUARD’
R__LOCKGUARD(mutex)
^
/home/physycom/Root/include/TInterpreter.h:329:7: note: in expansion of macro ‘R__LOCKGUARD2’
R__LOCKGUARD2(gInterpreterMutex);
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx: At global scope:
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:3:61: error: expected initializer before ‘dILaboratoriosP2dIFacoltativodIDiffsPSmorzatodIdOdIdiff_cxx_ACLiC_dictInit72’
#define R__DICTIONARY_FILENAME dIhomedIphysycomdIUniversitàdILaboratoriosP2dIFacoltativodIDiffsPSmorzatodIdOdIdiff_cxx_ACLiC_dict
^
/home/physycom/Root/include/RConfig.h:401:39: note: in definition of macro ‘NAME3

define NAME3(name1,name2,name3) name1##name2##name3

                                   ^

/home/physycom/Root/include/RConfig.h:421:27: note: in expansion of macro ‘R__JOIN3

define R__UNIQUE(X) R__JOIN3(R__DICTIONARY_FILENAME,X,LINE)

                       ^

/home/physycom/Root/include/RConfig.h:421:38: note: in expansion of macro ‘R__DICTIONARY_FILENAME’

define R__UNIQUE(X) R__JOIN3(R__DICTIONARY_FILENAME,X,LINE)

                                  ^

/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:38: note: in expansion of macro ‘R__UNIQUE
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:3:61: error: variable ‘ROOT::dIhomedIphysycomdIUniversit ROOT::dILaboratoriosP2dIFacoltativodIDiffsPSmorzatodIdOdIdiff_cxx_ACLiC_dictInit72_c’ has initializer but incomplete type
#define R__DICTIONARY_FILENAME dIhomedIphysycomdIUniversitàdILaboratoriosP2dIFacoltativodIDiffsPSmorzatodIdOdIdiff_cxx_ACLiC_dict
^
/home/physycom/Root/include/RConfig.h:400:33: note: in definition of macro ‘NAME2

define NAME2(name1,name2) name1##name2

                             ^

/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:105: note: in expansion of macro ‘R__UseDummy’
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
/home/physycom/Root/include/RConfig.h:419:30: note: in expansion of macro ‘NAME3

define R__JOIN3(F,X,Y) NAME3(F,X,Y)

                          ^

/home/physycom/Root/include/RConfig.h:421:27: note: in expansion of macro ‘R__JOIN3

define R__UNIQUE(X) R__JOIN3(R__DICTIONARY_FILENAME,X,LINE)

                       ^

/home/physycom/Root/include/RConfig.h:421:38: note: in expansion of macro ‘R__DICTIONARY_FILENAME’

define R__UNIQUE(X) R__JOIN3(R__DICTIONARY_FILENAME,X,LINE)

                                  ^

/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:117: note: in expansion of macro ‘R__UNIQUE
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
In file included from /home/physycom/Root/include/TObject.h:31:0,
from /home/physycom/Root/include/TNamed.h:26,
from /home/physycom/Root/include/TDictionary.h:45,
from /home/physycom/Root/include/TClass.h:25,
from /home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:14:
/home/physycom/Root/include/Rtypes.h:275:29: error: expected primary-expression before ‘public’
class NAME2(name,_c) { public: NAME2(name,_c)() { if (name) { } } }
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:105: note: in expansion of macro ‘R__UseDummy’
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
/home/physycom/Root/include/Rtypes.h:275:29: error: expected ‘}’ before ‘public’
class NAME2(name,_c) { public: NAME2(name,_c)() { if (name) { } } }
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:105: note: in expansion of macro ‘R__UseDummy’
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
/home/physycom/Root/include/Rtypes.h:275:29: error: expected ‘,’ or ‘;’ before ‘public’
class NAME2(name,_c) { public: NAME2(name,_c)() { if (name) { } } }
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:72:105: note: in expansion of macro ‘R__UseDummy’
static ::ROOT::TGenericClassInfo R__UNIQUE(Init) = GenerateInitInstanceLocal((const ::Diff)0x0); R__UseDummy(R__UNIQUE(Init));
^
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.cxx:167:1: error: expected ‘}’ at end of input
}
^
g++: error: /home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/./diff_cxx_ACLiC_dict.o: File o directory non esistente
Error in : Compilation failed!
(Int_t) -1
root [1]
[/code]
Instead, if i put the file in the root’s folder macros i receive no error.

root [0] gROOT->LoadMacro("./diff.cxx++g") Info in <TUnixSystem::ACLiC>: creating shared library /home/physycom/Root/macros/././diff_cxx.so (Int_t) 0 root [1]

Is there a solution for my problem?

May be you should post the macro ?..

Sure, here it is:

[code]#include “diff.h”

Diff::Diff(int fc) //costruttore default puntatori
{
comp = fc;
Y = new double[comp];
Z = new double[comp];
W = new double[comp];
x0 = new double[comp];
x = new double[comp];
funz = new p[comp];
dado = new ofstream;
dado->open(“RisDiff.txt”, ios::trunc);
}

void Diff::vallo() //calcola l’intervallo h
{
cout <<“Inserisci il numero di integrazioni\n”;
cin >>n;
cout <<“Inserisci in ordine i valori di t0 e tf\n”;
cin >>t0 >>tf;
h = (tf - t0)/n;
}

double * Diff::y()
{
double y= new double [comp];
for(int i=0; i<comp;++i)
{
Y[i] = x0[i]+0.5
h*funz[i](x0, t0);
}
return Y;
}

double * Diff::z()
{
double ips= y();
for(int i=0; i<comp;++i)
{
Z[i] = x0[i]+0.5
hfunz[i](ips, t0+0.5h);
}
return Z;
}

double * Diff::w()
{
double zed= z();
for(int i=0; i<comp;++i)
{
W[i] = x0[i]+h
funz[i](zed, t0+0.5*h);
}
return W;
}

void Diff::runge()
{
dado << “La prima colonna rappresenta la t, le altre ,invece, sono le varie x[i] ordinate” << ‘\n’;
for(int i=0; i<=n;++i)
{
dado << setw(6) << fixed << setprecision(6) << t0 <<" ";
for(int a=0; a<comp; ++a)
{
x[a] = x0[a] + h/6
(funza+2
funza+2*funza+funza);
*dado << setprecision(10) <<setw(14) << fixed << x[a] << " ";
}
t0 += h;
for(int b=0; b<comp; ++b)
{x0[b] = x[b];};
*dado << ‘\n’;
}
dado->close();
cout << “Le soluzioni trovate si trovano nel file “RisDiff.txt”. Arrivederci.\n”;
}
[/code]

And here is the diff.h:

[code]#include
#include
#include
#include
#ifndef DIFF_H
#define DIFF_H
using namespace std;
typedef double (p)(double, double);

class Diff
{
private:
double * x0, *x, *Y, *Z, *W; //i valori iniziali che diverranno anche quelli calcolati
double t0; //t iniziale
double tf; //t finale
double h; //intervallo
int n; //numero integrazioni
ofstream *dado;

public:
int comp; //componenti della funzione
p * funz;
friend void sign(Diff);
Diff(int fc); //costruttore default puntatori
void vallo(); //calcola l’intervallo h
double * y(); //valori particolari metodo runge kutta
double * z();
double * w();
void runge(); //algoritmo di runge kutta
};

extern void sign(Diff a);

#endif[/code]

But I don’t think the problem is the macro, because if I try with another one I get same errors.

Yes it looks fine for me:

root [0] .L diff.C++
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/couet/Downloads/./diff_C.so
root [1] 

Also this way:

root [0] gROOT->LoadMacro("./diff.C++")
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/couet/Downloads/././diff_C.so
(Int_t) 0
root [1] 

[quote=“couet”]Also this way:

root [0] gROOT->LoadMacro("./diff.C++") Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/couet/Downloads/././diff_C.so (Int_t) 0 root [1] [/quote]

Then, advices?

Try to change the full path:
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/
into something that does not contain any non-ascii characters (e.g. remove “à”) and without space characters inside.

[quote=“Wile E. Coyote”]Try to change the full path:
/home/physycom/Università/Laboratorio 2/Facoltativo/Diff Smorzato/
into something that does not contain any non-ascii characters (e.g. remove “à”) and without space characters inside.[/quote]

Thank you very much, i didn’t think that an accent could cause that problem.