0

I think I don"t have any forget ";" ..

I don't know why I have this error

class Erreur : public std::exception
{

private:
int m_numero;
int m_niveau;
std::string m_phrase;

public:

Erreur(int numero=0, int niveau=0, std::string const& phrase="") noexcept;

virtual ~Erreur() noexcept;

virtual const char* what() const noexcept;

int getNiveau() noexcept;

int getNumero() noexcept;
};

the compilateur says it coming from :

Erreur(int numero=0, int niveau=0, std::string const& phrase="") noexcept;
Choubidou
  • 351
  • 2
  • 4
  • 17
  • 1
    What compiler are you using and what version is it? – Captain Obvlious Aug 04 '13 at 04:29
  • 1
    Try `throw()` instead of `noexcept` and see if your compiler likes it better. If so, you apparently just have a compiler old enough that it doesn't implement `noexcept` yet. – Jerry Coffin Aug 04 '13 at 04:43
  • I just upgraded gcc now with macport , and gcc --version says : gcc (MacPorts gcc48 4.8.1_1) 4.8.1. But it seems it doesn't work too .. I get : Erreur.h:24:5: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++0x-compat] Erreur.h:24:68: error: expected ';' at end of member declaration and a list of error .. – Choubidou Aug 04 '13 at 05:19
  • This command worked .. g++ -Wall -std=c++11 main.cpp -o main – Choubidou Aug 04 '13 at 05:26

1 Answers1

0

I think that you might be working on some old compiler(I tried it on VS2010 and it doesn't support it.

Either upgrade your compiler or try using throw().

And if you want you function not to throw any exceptions, use nothrow

Saksham
  • 9,037
  • 7
  • 45
  • 73