本文主要是介绍ORB-slam2编译时报错‘usleep’ was not declared in this scope,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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
成功!
这篇关于ORB-slam2编译时报错‘usleep’ was not declared in this scope的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!