raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.17k stars 4.69k forks source link

./build.sh error when i run this it happened ,im a rookie in this somebody can help me? #1018

Closed pansyl closed 2 years ago

pansyl commented 2 years ago

[ 81%] Linking CXX executable ../Examples/Stereo/stereo_kitti ../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用 ../lib/libORB_SLAM2.so:对‘ORB_SLAM2::MapDrawer::MapDrawer(ORB_SLAM2::Map*, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/mono_kitti.dir/build.make:159: recipe for target '../Examples/Monocular/mono_kitti' failed make[2]: [../Examples/Monocular/mono_kitti] Error 1 CMakeFiles/Makefile2:224: recipe for target 'CMakeFiles/mono_kitti.dir/all' failed make[1]: [CMakeFiles/mono_kitti.dir/all] Error 2 make[1]: 正在等待未完成的任务.... ../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用 ../lib/libORB_SLAM2.so:对‘ORB_SLAM2::MapDrawer::MapDrawer(ORB_SLAM2::Map, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/rgbd_tum.dir/build.make:159: recipe for target '../Examples/RGB-D/rgbd_tum' failed make[2]: ** [../Examples/RGB-D/rgbd_tum] Error 1 CMakeFiles/Makefile2:120: recipe for target 'CMakeFiles/rgbd_tum.dir/all' failed make[1]: [CMakeFiles/rgbd_tum.dir/all] Error 2 ../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用 ../lib/libORB_SLAM2.so:对‘ORB_SLAM2::MapDrawer::MapDrawer(ORB_SLAM2::Map*, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/mono_tum.dir/build.make:159: recipe for target '../Examples/Monocular/mono_tum' failed make[2]: [../Examples/Monocular/mono_tum] Error 1 CMakeFiles/Makefile2:250: recipe for target 'CMakeFiles/mono_tum.dir/all' failed make[1]: [CMakeFiles/mono_tum.dir/all] Error 2 ../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用 ../lib/libORB_SLAM2.so:对‘ORB_SLAM2::MapDrawer::MapDrawer(ORB_SLAM2::Map*, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/stereo_kitti.dir/build.make:159: recipe for target '../Examples/Stereo/stereo_kitti' failed make[2]: [../Examples/Stereo/stereo_kitti] Error 1 CMakeFiles/Makefile2:172: recipe for target 'CMakeFiles/stereo_kitti.dir/all' failed make[1]: [CMakeFiles/stereo_kitti.dir/all] Error 2 ../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用 ../lib/libORB_SLAM2.so:对‘ORB_SLAM2::MapDrawer::MapDrawer(ORB_SLAM2::Map*, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/mono_euroc.dir/build.make:159: recipe for target '../Examples/Monocular/mono_euroc' failed make[2]: [../Examples/Monocular/mono_euroc] Error 1 CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/mono_euroc.dir/all' failed make[1]: [CMakeFiles/mono_euroc.dir/all] Error 2 ../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用 ../lib/libORB_SLAM2.so:对‘ORB_SLAM2::MapDrawer::MapDrawer(ORB_SLAM2::Map*, std::string const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用 ../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/stereo_euroc.dir/build.make:159: recipe for target '../Examples/Stereo/stereo_euroc' failed make[2]: [../Examples/Stereo/stereo_euroc] Error 1 CMakeFiles/Makefile2:198: recipe for target 'CMakeFiles/stereo_euroc.dir/all' failed make[1]: [CMakeFiles/stereo_euroc.dir/all] Error 2 Makefile:90: recipe for target 'all' failed make: *** [all] Error 2

LMWafer commented 2 years ago

I had a similar problem and added

#include<unistd.h>

into include/System.h before running

./build.sh

in ORB_SLAM2/.

As System.h is probably one of the first files to be called, adding the code will apply its modifications to all the other headers called within/after it.

If you still have this problem, add the include to all the .cc files mentioned in

CMakeFiles/<filedir/filename>make:159: recipe for target '<filedir/filename.cc>`

-like lines and retry

rm -rf build && ./build.sh

until you have no more files do modify !

pansyl commented 2 years ago

I had a similar problem and added

#include<unistd.h>

into include/System.h before running

./build.sh

in _ORBSLAM2/.

As System.h is probably one of the first files to be called, adding the code will apply its modifications to all the other headers called within/after it.

If you still have this problem, add the include to all the .cc files mentioned in

CMakeFiles/<filedir/filename>make:159: recipe for target '<filedir/filename.cc>`

-like lines and retry

rm -rf build && ./build.sh

until you have no more files do modify !

thank you for you help! I have already added and I found that my Pangolin version is the latest version that maybe have some bug or mistake. So i change Pangolin to the old version and succeed "build.sh" . Thank you again!

BorisWang-1219 commented 2 years ago

I had these similar problems , and i had added "#include" in every .cc project, i also changed the version of my Pangolin to 0.5. The attempt of these methods did not solve my problem. What should I do?

IncludeMathH commented 5 months ago

I had the same problem!