ORB-slam2编译时报错‘usleep’ was not declared in this scope:
Ubuntu18.04编译ORB-SLAM2遇到的问题
1.内存不足
2.‘usleep’ was not declared in this scope
问题描述:
编译./build.sh时遇到了如下问题
ORB_SLAM2/src/LocalMapping.cc:94:17: error: ‘usleep’ was not declared in this scope usleep(3000);
一开始根据报错信息在LocalMapping.cc的头文件添加
include<unistd.h>
随后依旧报错,只是报错的文件名改变,经查询,需要在以下的文件下添加头文件:
在下面的每一个文件中,加上头文件语句***#include<unistd.h>***,然后重新编译
ORB_SLAM2/src/LocalMapping.cc
ORB_SLAM2/src/LoopClosing.cc
ORB_SLAM2/src/System.cc
ORB_SLAM2/src/Tracking.cc
ORB_SLAM2/src/Viewer.cc
ORB_SLAM2/Examples/Monocular/mono_euroc.cc
ORB_SLAM2/Examples/Monocular/mono_kitti.cc
ORB_SLAM2/Examples/Monocular/mono_tum.cc
ORB_SLAM2/Examples/RGB-D/rgbd_tum.cc
ORB_SLAM2/Examples/Stereo/stereo_euroc.cc
ORB_SLAM2/Examples/Stereo/stereo_kitti.cc
成功!