ORB_SLAM2 icon indicating copy to clipboard operation
ORB_SLAM2 copied to clipboard

Fix many errors: ‘usleep’ was not declared

Open booiljung opened this issue 5 years ago • 2 comments

There are many compile time errors. This PR fixes these errors.

/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::Run()’:
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:84:9: error: ‘usleep’ was not declared in this scope
         usleep(5000);
         ^~~~~~
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:84:9: note: suggested alternative: ‘fseek’
         usleep(5000);
         ^~~~~~
         fseek
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::CorrectLoop()’:
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:416:20: warning: use of an operand of type ‘bool’ in ‘operator++’ is deprecated [-Wdeprecated]
         mnFullBAIdx++;
                    ^~
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:428:9: error: ‘usleep’ was not declared in this scope
         usleep(1000);
         ^~~~~~
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:428:9: note: suggested alternative: ‘fseek’
         usleep(1000);
         ^~~~~~
         fseek
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::RequestReset()’:
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:630:9: error: ‘usleep’ was not declared in this scope
         usleep(5000);
         ^~~~~~
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:630:9: note: suggested alternative: ‘fseek’
         usleep(5000);
         ^~~~~~
         fseek
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::RunGlobalBundleAdjustment(long unsigned int)’:
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:670:17: error: ‘usleep’ was not declared in this scope
                 usleep(1000);
                 ^~~~~~
/home/booil/linspace/orbslam/ORB_SLAM2/src/LoopClosing.cc:670:17: note: suggested alternative: ‘fseek’
                 usleep(1000);
                 ^~~~~~
                 fseek
/home/booil/linspace/orbslam/ORB_SLAM2/src/Tracking.cc: In member function ‘void ORB_SLAM2::Tracking::Reset()’:
/home/booil/linspace/orbslam/ORB_SLAM2/src/Tracking.cc:1512:13: error: ‘usleep’ was not declared in this scope
             usleep(3000);
             ^~~~~~
/home/booil/linspace/orbslam/ORB_SLAM2/src/Tracking.cc:1512:13: note: suggested alternative: ‘fseek’
             usleep(3000);
             ^~~~~~
             fseek

booiljung avatar Aug 17 '20 08:08 booiljung

add #include <unistd.h> #include <stdio.h> #include <stdlib.h> in "system.h"

linuxsen avatar Jan 03 '21 14:01 linuxsen

Same problem on Ubuntu 18.04 and @linuxsen 's fix worked for me! ( "System.h", not "system.h")

dcaffo98 avatar Oct 19 '21 11:10 dcaffo98