Problems mit ClassDef under Visual C++

Hi
I am currently modifying a data acquisition software we are using in the group. It runs as stand alone software using the root framwork, and i am using Visual C++ 2010 for programming.

Now i added a new class MyDet into the program. As described in the root manual I used ClassDef and rootcint to generate the code MyDetcint.cpp and added it into my project.
But when i try to compile the project now the compiler does not recognize the ClassDef keyword, i get a syntax error:

1>c:\acqirisacquisitionandanalysis\agat tof\mydet.h(38): error C2059: syntax error : 'constant'
1>c:\acqirisacquisitionandanalysis\agat tof\mydet.h(39): error C2143: syntax error : missing ';' before '}'
1>c:\acqirisacquisitionandanalysis\agat tof\mydet.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\acqirisacquisitionandanalysis\agat tof\mydet.h(39): warning C4183: 'ClassDef': missing return type; assumed to be a member function returning 'int'

The MyDet.h looks like this:

#ifndef __MyDet_H_
#define __MyDet_H_

class MyEvent;
class MyChannel;
class MyPeak;

class MyDet  
{
public:
	MyDet(const char * name);
	virtual ~MyDet();

	void getChan(MyEvent *ev, double * chan, MyPeak ** chanpeak);
	double getChan(MyEvent *ev);

	int getChanHits(MyEvent * ev) const {return count;}

	void getChanSettings(long &c, long &rf, long &mrt);
	void setChanSettings(long c, long rf, long rt);

	void saveSettings();
	void loadSettings();

protected:
	const char * myName;
	long chan, RangeFrom, RangeTo;

	void extractByPol(MyChannel *ch, double * val, MyPeak ** peak, int pol);
	void extractByTimeRange(MyChannel *ch, double * val, MyPeak ** peak, double RangeFrom, double RangeTo);
	double extractByPol(MyChannel *ch, int pol);
	double extractByTimeRange(MyChannel *ch, double RangeFrom, double RangeTo);
	void clearValue(double * val, MyPeak ** peak);

private:
	int count;

	ClassDef(MyDet,0) // Basic Detector
};
#endif 

and the MyDetLinkDef.h

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class MyDet;

#endif

Well i am not so much experienced in this software so it might be a very stupid problem.

Hi,

You should add #include “Rtypes.h” (or #include “TObject.h”) in your MyDet.h

Cheers, Bertrand.

Thanks a lot
Problem solved