Unnamed macro

i use root in cygwin. when i run a c++ program ,there is a error:
Error: Bad source file(unnamed macro) /home/winsert/./v.txt FILE:v.txt LINE:1
unnamed macro has to be executed by ‘x’ command

why? Thanks!

Hi,

What C++ program? Do you mean a macro? What exactly are you trying to do?

[quote=“winsert”]there is a error:
Error: Bad source file(unnamed macro) /home/winsert/./v.txt FILE:v.txt LINE:1
unnamed macro has to be executed by ‘x’ command
why?[/quote]
I cannot deduct from the little info your provide what you’re doing (and what you’re doing wrong). Send us the command you execute, and the macro you’re trying to execute (if that’s what you do), so we can reproduce your problem.

Axel.

{
int i;
int k=n;
float a[n];
float b[n];
FILE *fp;

 if((fp=fopen("c:\\date.txt","r"))==NULL)
	cout<<"Failed open the file";
 for(i=0;i<n;i++)

 {  a[i]=0.1*i; 
        fscanf(fp,"%e",&b[i]);
    cout<<b[i]<<endl;
 }

TCanvas *c1= new TCanvas(“c1”,“Rate”,500,100,1000,800);
TGraph gr= new TGraph(k,x,y);
gr->Draw("AC
");

}

Hi,

I have no problem running your unnamed macro after fixing it.

// testunnamed.C:
{
int i;
int n=5;
int k=n;
float a[n];
float b[n];
FILE *fp;

if((fp=fopen(“date.txt”,“r”))==NULL)
cout<<“Failed open the file”;
for(i=0;i<n;i++)

{ a[i]=0.1*i;
fscanf(fp,"%e",&b[i]);
cout<<b[i]<<endl;
}
TCanvas *c1= new TCanvas(“c1”,“Rate”,500,100,1000,800);
TGraph gr= new TGraph(k,a,b);
gr->Draw("AC
");

}

“.x testunnamed.C” works for me.
Axel.