title: error: ‘NOEXCEPT’ does not name a type | error: expected initializer before ‘_NOEXCEPT’
body: <p>I am trying to compile C++ a file on my RaspberryPi (Linux) but it is throwing an error of :</p>
  
  <blockquote>
    <p>error: expected initializer before ‘_NOEXCEPT’
     JSONException JSONException::MissingKey(const std::string &amp;key) _NOEXCEPT
                                                                     ^
    /root/libapiai_demo/libapiai/apiai/src/exceptions/JSONException.cpp:23:101: error: expected initializer before ‘_NOEXCEPT’
     JSONException JSONException::TypeMismatch(const std::string &amp;key, const std::string &amp;expected_type) _NOEXCEPT</p>
  </blockquote>
  
  <p>I even tried to replace it with throw() and _GLIBCXX_USE_NOEXCEPT but that didn't work.</p>
  
  <p>On replacing it with noexcept (small) 
  It throws an error of:</p>
  
  <blockquote>
    <p>error: declaration of ‘ai::Exception::Exception(const char*) noexcept’ has >a different exception specifier
        Exception::Exception(const char *reason) noexcept: reason(reason) {</p>
  </blockquote>
  
  <p>Is it a problem with my compiler but I am using a latest one.</p>
  
  <p>My CMake txt file also has :</p>
  
  <pre><code>include(CheckCXXCompilerFlag)
  CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
  CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
  if(COMPILER_SUPPORTS_CXX11)
          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  elseif(COMPILER_SUPPORTS_CXX0X)
          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  else()
          message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
  endif()
  
  add_compile_options(-std=c++11)
  </code></pre>
  
  <p>For code to compile, still it throws errors.</p>
  
  <p>g++ --version
  g++ (Raspbian 4.9.2-10) 4.9.2</p>
  
  <p>Below is the 1 such file which throws the error.</p>
  
  <p>Is it like 4.9.2 doesn't support noexcept. Can someone help me with this since I am stuck.</p>
  
  <pre><code>#ifndef EXCEPTION_H
  #define EXCEPTION_H
  
  #include &lt;string&gt;
  #include &lt;exception&gt;
  
  namespace ai {
  
  class Exception: public std::exception
  {
  private:
      std::string reason;
  public:
  
      Exception(const char *reason) _NOEXCEPT;
  
      virtual const char* what() const _NOEXCEPT override;
  
      virtual ~Exception() _NOEXCEPT;
  };
  
  }
  #endif // EXCEPTION_H
  </code></pre>