1

Does anyone know how to remove the error of std::chrono::monotonic_clock in Linux OS (Ubuntu 14.04)? I have the headers of chrono, time ,unistd.h stdio.h but the same error shows up.

Ajay
  • 18,086
  • 12
  • 59
  • 105
ramtin
  • 11
  • 1
  • 2
  • The error has nothing to do with your operating system, but with which version of the compiler you're using, which you did not state, so no answer is possible. The most likely answer is that your compiler is too old, and does not implement this C++11 class. – Sam Varshavchik Jun 07 '16 at 10:19
  • 4
    I think you are looking for [std::chrono::steady_clock](http://en.cppreference.com/w/cpp/chrono/steady_clock)? – Galik Jun 07 '16 at 10:19
  • @Sam Varshavchik The version of my compiler : g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4. And I used "g++ -std=c++11 -o mono_tum mono_tum.cc `pkg-config opencv --cflags --libs` -DECOMPILEDWITHC11" to compile. – ramtin Jun 07 '16 at 10:27
  • That is an old compiler, that implements very little of C++11. For full support of C++1z, at least gcc 5.3, or higher, is needed. – Sam Varshavchik Jun 07 '16 at 10:31
  • @Galik There are two lines in the code. For "std::chrono::steady_clock" there is no error, for ‘std::chrono::monotonic_clock’ I received errors also for t1 and t2. – ramtin Jun 07 '16 at 10:32
  • @Galik Here is the part of the code, which made an error: #ifdef COMPILEDWITHC11 std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now(); #else std::chrono::monotonic_clock::time_point t2 = std::chrono::monotonic_clock::now(); #endif double ttrack= std::chrono::duration_cast >(t2 - t1).count(); vTimesTrack[ni]=ttrack; – ramtin Jun 07 '16 at 10:36
  • 2
    There is no `monotonic_clock` in C++11; there was one in old working drafts, but it got changed into `steady_clock`. – T.C. Jun 07 '16 at 10:40
  • @SamVarshavchik GCC 4.8.4's C++11 support is actually decent - the language is feature-complete, the library just missing a few things. – T.C. Jun 07 '16 at 10:40
  • @ SamVarschavchik . That's right @T.C. I used also sudo update-alternatives --config g++ and updated my GCC version to 4.8.5. For C++11 support in GCC, it's written in the official website that, more than 4.8 is not needed. https://gcc.gnu.org/projects/cxx-status.html#cxx11 – ramtin Jun 07 '16 at 11:29
  • http://stackoverflow.com/questions/6777278/what-is-the-rationale-for-renaming-monotonic-clock-to-steady-clock-in-chrono – T.C. Jun 07 '16 at 11:43
  • Thanks @T.C. I have replaced monotonic_clock to steady_clock & the error was removed but I 've got the new error named as : undefined reference. mono_tum.cc:(.text+0x880): undefined reference to `ORB_SLAM2::System::SaveKeyFrameTrajectoryTUM(std::string const&)' – ramtin Jun 07 '16 at 12:33

0 Answers0