c++ - Problems with std::chrono -


i having trouble compiling chrono, here code:

time.hh

#include        <chrono>  class           time { protected:   std::chrono::steady_clock::time_point _start_t;   std::chrono::steady_clock::time_point _now;   std::chrono::steady_clock::time_point _time; public:   time();   time(const time &other);   time          &operator=(const time &other);   ~time(); public:   void          start();   double        getdursec();   double        getdurmilsec(); private:   void          setnow(); }; 

compilation error:

g++  -w -wall -wextra -i./include -std=c++0x  -c -o src/time/time.o src/time/time.cpp in file included src/time/time.cpp:11:0: ./include/time/time.hh:21:3: error: ‘steady_clock’ in namespace ‘std::chrono’ not     name type ./include/time/time.hh:22:3: error: ‘steady_clock’ in namespace ‘std::chrono’ not name type ./include/time/time.hh:23:3: error: ‘steady_clock’ in namespace ‘std::chrono’ not name type src/time/time.cpp: in member function ‘void time::start()’: src/time/time.cpp:34:2: error: ‘_time’ not declared in scope src/time/time.cpp:34:23: error: ‘std::chrono::steady_clock’ has not been declared 

etc...

tell me if need more informations.

you using g++ version prior 4.7.0 std::chrono::steady_clock not implemented. if case, have 2 solutions:

  • upgrade g++ 4.7.0 or more recent version.
  • use instead old std::chrono::monotonic_clock.

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -