Getting Error "looser throw specifier for `virtual APIEx::~APIEx()'"

Hi I am new to C++. I am getting this error when i am compiing the below piece of code. I am using eclipse Helios IDE for windows 32.

#ifndef APIEX_H_
#define APIEX_H_

#include <exception>

class APIEx: public std::exception {
public:
APIEx();
virtual ~APIEx(); ///Here i am getting this error.[/b]};

#endif

Please advice me what i am missing here.

Thanks in advance.
Ashok Mohanty
Last edited on
try changing it to this:

1
2
3
4
5
class APIEx: public std::exception {
public:
APIEx() throw();
virtual ~APIEx() throw(); 
};
Thanks For your quick reply. But it is still not working. I think i have to explain you everything abt IDE and compiler etc.. I am using below setups.
1. MINGW/MINSys
2. Eclipse Helios IDE for windows.
3. GCC 3.4.5
4. I am adding one class i.e APIEx from new menu .
5. It adds two files i.e APIEx.h and APIEx.cpp

Class APIEX.h
--------------------------------
#ifndef APIEX_H_
#define APIEX_H_

#include <exception>

class APIEx: public std::exception {
public:
APIEx() throw(); //Error- than previous declaration `APIEx::APIEx() throw ()'
virtual ~APIEx() throw(); //Error-than previous declaration `virtual APIEx::~APIEx() throw ()'
};

#endif /* APIEX_H_ */


Class APIEx.CPP
----------------------------
#include "APIEx.h"

APIEx::APIEx() {
//Error- declaration of `APIEx::APIEx()' throws different exceptions

}

APIEx::~APIEx() {
//Error- declaration of `virtual APIEx::~APIEx()' throws different exceptions
}

Hope i am clear this time.

Thanks
Ashok
The same applies when you define it in the .cpp add throw() right afterwards, so:
Class APIEx.CPP
----------------------------
1
2
3
4
5
6
7
8
9
10
#include "APIEx.h"

APIEx::APIEx() throw() {
//Error- declaration of `APIEx::APIEx()' throws different exceptions

}

APIEx::~APIEx() throw() {
//Error- declaration of `virtual APIEx::~APIEx()' throws different exceptions
}
The same applies when you define it in the .cpp add throw() right afterwards, so:
Class APIEx.CPP
----------------------------
1
2
3
4
5
6
7
8
9
10
#include "APIEx.h"

APIEx::APIEx() throw() {
//Error- declaration of `APIEx::APIEx()' throws different exceptions

}

APIEx::~APIEx() throw() {
//Error- declaration of `virtual APIEx::~APIEx()' throws different exceptions
}
Thanks..Its solved.
Topic archived. No new replies allowed.