title: Creating new exception in C++
body: <p>I have a C++ class and I am trying to run it in Ubuntu:</p>
  
  <pre><code>#ifndef WRONGPARAMETEREXCEPTION_H_
  #define WRONGPARAMETEREXCEPTION_H_
  
  #include &lt;iostream&gt;
  #include &lt;exception&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  #pragma once
  
  class WrongParameterException: public exception
  {
      public:
          WrongParameterException(char* message): exception(message) {};
          virtual ~WrongParameterException() throw() {};
  }; 
  
  #endif
  </code></pre>
  
  <p>when I try to compile it, the compiler gives me this error:</p>
  
  <pre><code>WrongParameterException.h: In constructor ‘WrongParameterException::WrongParameterException(char*)’:
  WrongParameterException.h:14: error: no matching function for call to ‘std::exception::exception(char*&amp;)’
  /usr/include/c++/4.3/exception:59: note: candidates are: std::exception::exception()
  /usr/include/c++/4.3/exception:57: note: std::exception::exception(const std::exception&amp;)
  </code></pre>
  
  <p>Can anyone tell me what am I doing wrong? I tried changing the message variable to <code>string</code> or <code>const string</code> or <code>const string&amp;</code> but it didn't help.</p>
  
  <p>Here is how I use the new exception that I created from main:</p>
  
  <pre><code>try
  {
       if ((strToInt1 == -1) || (parameters[1] == NULL) || (strToInt3 == -1) || (parameters[3] != NULL))
       {
            throw WrongParameterException("Error in the config or commands file");
       }
  }
  catch(WrongParameterException e)
  {
       log.addMsg(e.what());
  }
  </code></pre>