++ - error: expected unqualified-id before ‘const’

 

++ - error: expected unqualified-id before ‘const’ -


i have seen few questions on error, don't have experience making class in c++, don't understand answers mean. should point out didn't write code.

i'm getting error stated in title, , believe it's coming header file, have no idea error means , how fix it.

here file:

#ifndef _quicktimer_h_ #define _quicktimer_h_  #include <cstdlib> #include <string> #include <chrono>  class quicktimer { public:   quicktimer(const std::string& prefix = "");   ~quicktimer(); private:   std::chrono::high_resolution_clock::time_point mstarttime;   const std::string mprefix; };  #endif 

and full errors:

error: expected unqualified-id before ‘const’  quicktimer(const std::string& prefix) :             ^    error: expected ‘)’ before ‘const’  error: declaration of ‘~quicktimer’ non-member  ~quicktimer()              ^ 

if explain me means , what's going on, i'd appreciate it, thanks!

class name prefix missing in definition of constructor , destructor. should have in cpp file :

quicktimer::quicktimer(const std::string& prefix) { }  quicktimer::~quicktimer() { } 

Comments