出现以下报错:
[ 50%] Linking CXX executable trajectoryError
/usr/bin/ld: CMakeFiles/trajectoryError.dir/trajectoryError.cpp.o: in function `std::make_unsigned<int>::type fmt::v8::detail::to_unsigned<int>(int)':
trajectoryError.cpp:(.text._ZN3fmt2v86detail11to_unsignedIiEENSt13make_unsignedIT_E4typeES4_[_ZN3fmt2v86detail11to_unsignedIiEENSt13make_unsignedIT_E4typeES4_]+0x23): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
说明fmt库没有链接成功,因此需要链接fmt库,方法如下:
将CMakeLists.txt中:
target_link_libraries(trajectoryError ${Pangolin_LIBRARIES} ${FMT_LIBRARIES})
改为:(注意下面fmt前面有空格!)
target_link_libraries(trajectoryError ${Pangolin_LIBRARIES} ${FMT_LIBRARIES} fmt)
再次编译,问题解决。
运行时,新的问题出现:
trajectory ./example/groundtruth.txt not found.
trajectory ./example/estimated.txt not found
原因是没有找到需要的txt文件
解决方案:
编辑trajectoryError.cpp,将以下两行
string groundtruth_file = "./example/groundtruth.txt";
string estimated_file = "./example/estimated.txt";
转换为绝对路径:
string groundtruth_file = "../example/groundtruth.txt";
string estimated_file = "../example/estimated.txt";
再次编译后,再使用:
./trajectoryError
即可得到轨迹误差评估结果。
参考并使用该博主的一部分内容,且在其基础上解决了一部分问题: