Makefile

Hi
I am looking for some documentation to make my own makefile for my simple script. Could somebody point me out to documentation I could use to do this?

i have notice in other postings in the forums that people make reference to test/Makefile
i had a look at it and it seems overwhelming complicated… is tehere any other straight forward example I could use?
Thank you in advanced,
Cristian

Hi
Working with the make file provided by Rene Brun in $(ROOTSYS)/test, I have modified its Makefile to include my own file (peakfit.cxx). However when I tried to compile it, it gives me an error everytime I declare an array, saying that it is expected an “]” before";". Could anyone reproduce this error? Has anyone seem something like this before?

I have included in this e-mail the source file, the output and the makefile. Note the makefile and source file has to be saved in the $(ROOTSYS)/test directory.

Thank you for your help,
Cristian

Remark: remove extension of attached makefile

____________________________________SOURCE
//source file name: peakfit.cxx

//SYSTEM include files
#include
#define LIM 12;

//ROOT include files
#include <fcntl.h>
#include <TSpectrum.h>
#include <TPolyMarker.h>
#include <TMath.h>
#include <TAxis.h>
#include <TStyle.h>
#include <TAttLine.h>
#include <TH1.h>
#include <TObjString.h>

int main(int argc,char argv[]){
/
----------------------------------------------
VARIABLES FOR READING ASCII DATA
------------------------------------------------*/
const char *strtmp = new char[64];
FILE *fp;
int ptmp;
int i=0, nbins;
int rxmin, rxmax;
int buffer[LIM];

for (;i<LIM;i++) buffer[i]=i;
for (;i<LIM;i++) printf(" line %d\n",buffer[i]);

printf(“Normal termination…\n\n”);

}

____________________________________OUTPUT
bash-3.1$ make
g++ -O -Wall -fPIC -pthread -I/home/cmosquer/root/include -c peakfit.cxx
peakfit.cxx: In function ‘int main(int, char**)’:
peakfit.cxx:37: error: expected ]' before ‘;’ token peakfit.cxx:37: error: expected primary-expression before ‘]’ token peakfit.cxx:37: error: expected;’ before ‘]’ token
peakfit.cxx:39: error: expected primary-expression before ‘;’ token
peakfit.cxx:39: error: expected )' before ‘;’ token peakfit.cxx:39: error: expected;’ before ‘)’ token
peakfit.cxx:40: error: expected primary-expression before ‘;’ token
peakfit.cxx:40: error: expected )' before ‘;’ token peakfit.cxx:40: error: expected;’ before ‘)’ token
peakfit.cxx:32: warning: unused variable ‘strtmp’
peakfit.cxx:33: warning: unused variable ‘fp’
peakfit.cxx:34: warning: unused variable ‘ptmp’
peakfit.cxx:35: warning: unused variable ‘nbins’
peakfit.cxx:36: warning: unused variable ‘rxmin’
peakfit.cxx:36: warning: unused variable ‘rxmax’
make: *** [peakfit.o] Error 1
bash-3.1$
Makefile.cxx (13.6 KB)

Hi,

This particular error is in your .cxx file not your Makefile.
Instead of#define LIM 12;use#define LIM 12Aka remove the trailing ;

Cheers,
Philippe

[quote=“pcanal”]Hi,

This particular error is in your .cxx file not your Makefile.
Instead of#define LIM 12;use#define LIM 12Aka remove the trailing ;

Cheers,
Philippe[/quote]

Thank you Phillipe. You were totally right!

Cristian