错误:ISO C++禁止声明'TimerExeption'没有类型

rit*_*ode 2 c++ exception-handling

尝试在我的timer.cpp文件中抛出TimerException类型的异常时,我收到此错误.这是timer_exception.h

  1 #ifndef TIMER_EXCEPTION_H
  2 #define TIMER_EXCEPTION_H
  3                              
  4 #include <iostream>
  5 #include <string>   
  6                                                                        
  7 class TimerException{         
  8         friend std::ostream &operator <<(std::ostream &os, const TimerException e){
  9                 std::cout << " *** TIMER EXCEPTION *** " << e.message;
 10                 return os;    
 11         }                                
 12 public:                         
 13         TimerExeption(std::string message) : message(message) {}
 14 private:                        
 15         std::string message;                   
 16 };                                         
 17                       
 18                                 
 19 #endif   
Run Code Online (Sandbox Code Playgroud)

这是我的timer.cpp文件,其中正在实例化TimerException

  1 #include <ctime>
  2 #include "timer.h"
  3 #include "timer_exception.h" 
  4 
  5 void Timer::start(){
  6         if(timer != 0) throw TimerException("Timer already started");
  7         this->timer = clock();
  8 }       
Run Code Online (Sandbox Code Playgroud)

us2*_*012 5

简单的拼写错误.你在构造函数名称中缺少'c'.

13         TimerExeption(std::string message) : message(message) {}
//               ^^^
Run Code Online (Sandbox Code Playgroud)