Compilation problem

Hi,

Why is this simple code not compiling?

test.h

#ifndef __test__
#define __test__
#include "TF1.h"

class test 
{
private:
	TF1   *fFunc;

public:
	test();
	~test();
	double  FitFunc(double *x, double *par);        // a fit function
};
#endif

test.cxx

#include "test.h"

test::test()
{
	fFunc = new TF1("FitFunc", FitFunc, 0.0, 1.0, 1);      // fit function
}

double test::FitFunc(double *x, double *par)
{
	return par[0]*x[0];
}

errors:
/home/test.cxx:5: error: no matching function for call to ‘TF1::TF1(const char [8], , double, double, int)’

Thanks

test.h[code]#ifndef test
#define test

class TF1;

class test
{
private:
TF1 *fFunc;

public:
test();
~test() {;};
};
#endif[/code]test.cxx[code]#include “test.h”
#include <TF1.h>

double FitFunc(double *x, double *par);

test::test()
{
fFunc = new TF1(“FitFunc”, FitFunc, 0.0, 1.0, 1); // fit function
}

double FitFunc(double *x, double *par)
{
return par[0]*x[0];
}
[/code]Jan

do
test.h

[code]#ifndef test
#define test
#include “TF1.h”

class test
{
private:
TF1 *fFunc;

public:
test();
~test();
};
#endif [/code]

test.cxx

[code]#include “test.h”
#include <TF1.h>

double FitFunc(double *x, double *par)
{
return par[0]*x[0];
}
test::test()
{
fFunc = new TF1(“FitFunc”, FitFunc, 0.0, 1.0, 1); // fit function
}

[/code]
and see doc of TF1

Rene

Thanks a lot for your quick reply. I tried both ways. Both codes did not compile.

Also, it will be very helpful if it is possible to define the FitFunc(double *x, double *par) inside the class “test” as its member function. Your help will be greatly appreciated.

Thanks.

my code compiles if you add (this should be obvious!) the dummy destructor.
see the doc of TF1 for the remaining part of your question.

Rene

Thanks.