Hi,

I wrote a class WAVELET1 in borland c++ 6.0 environment.
And used this class member function in another file.
It always said there was error when compiled.
The error messages were as followings,

[C++ Error] wavelet.h(6): E2238 Multiple declaration for 'WAVELET1'
[C++ Error] wavelet.h(6): E2344 Earlier declaration of 'WAVELET1'

And i searched 'WAVELET1' in whole project file, the results were as followings,

C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\FIRFilter.cpp(112): fir= new WAVELET1;
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\FIRFilter.h(39): WAVELET1 *fir;
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.cpp(12): WAVELET1::WAVELET1(void)
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.cpp(12): WAVELET1::WAVELET1(void)
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.cpp(16): WAVELET1::~WAVELET1(void)
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.cpp(16): WAVELET1::~WAVELET1(void)
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.cpp(20): void WAVELET1::testTF(int fNumSample, double fSamplingRate, double *fTestdata )
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.cpp(176): double WAVELET1::correlation (int fLowCheckFreq, int fHighCheckFreq, int fLowCheckSample, int fHighCheckSample, double fNormRightTemplate, double fNormLeftTemplate, double *flefttemplate, double *frighttemplate)
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.h(6): class WAVELET1 {
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.h(11): WAVELET1( void );
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.h(12): ~WAVELET1( void );
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.h(6): class WAVELET1 {
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.h(11): WAVELET1( void );
C:\yangqdata\BCI2000\src\SignalProcessing1\FIR\wavelet.h(12): ~WAVELET1( void );

The last three were the same as the three before last three.
It was strange.
The wavelet.h file is as following,

#define LOWFREQ    1
#define HIGHFREQ   30
#define CHANNEL    2
#define MAXSAMPLE  200
 
 
class   WAVELET1  {
private:
        double fTF [CHANNEL][HIGHFREQ-LOWFREQ+1][MAXSAMPLE];
public:
        WAVELET1( void );
        ~WAVELET1( void );
        void testTF( int,double, double *);
        double correlation( int, int, int,int, double, double, double *, double *);
} ;

I don't know what's wrong?

Tina

I'm betting your header file doesn't have inclusion guards on it:

#ifndef MY_HEADER
#define MY_HEADER

#define LOWFREQ    1
#define HIGHFREQ   30
#define CHANNEL    2
#define MAXSAMPLE  200
 
 
class   WAVELET1  {
private:
        double fTF [CHANNEL][HIGHFREQ-LOWFREQ+1][MAXSAMPLE];
public:
        WAVELET1( void );
        ~WAVELET1( void );
        void testTF( int,double, double *);
        double correlation( int, int, int,int, double, double, double *, double *);
} ;

#endif

Failure to do that will cause problems with most headers if you include them multiple times in your project.

Thank you very much!
It worked.

I'm betting your header file doesn't have inclusion guards on it:

#ifndef MY_HEADER
#define MY_HEADER
 
#define LOWFREQ    1
#define HIGHFREQ   30
#define CHANNEL    2
#define MAXSAMPLE  200
 
 
class   WAVELET1  {
private:
        double fTF [CHANNEL][HIGHFREQ-LOWFREQ+1][MAXSAMPLE];
public:
        WAVELET1( void );
        ~WAVELET1( void );
        void testTF( int,double, double *);
        double correlation( int, int, int,int, double, double, double *, double *);
} ;
 
#endif

Failure to do that will cause problems with most headers if you include them multiple times in your project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.