This blog records the errors encountered in the process of using sophus.
1. Cannot find header file fatal error: sophus/SO3 HPP: no such file or directory
1.1 problem description
fatal error: sophus/so3.hpp: no such file or directory
Reason:
GitHub is now a new version of sophus, which is based on the template class, and its corresponding header file is .h
, while the header file corresponding to sophus based on non-template class is .hpp
, so an error will be reported.
1.2 solutions
Put in the code
#include "sophus/so3.hpp"
#include "sophus/se3.hpp"
sophus::sophus SO3d;
sophus::sophus SE3d;
Change all to
#include "sophus/so3.h"
#include "sophus/se3.h"
sophus::sophus SO3;
sophus::sophus SE3;
2. /usr/bin/LD: not found - lsophus:: sophus
2.1 error reporting prompt
Compilation error
/usr/bin/ld: Could not find -lSophus::Sophus
/usr/bin/ld: Could not find -lSophus::Sophus
collect2: error: ld returned 1 exit status
2.2 solutions
My original cmake:
list(APPEND ALL_TARGET_LIBRARIES ${Sophus_LIBRARIES} Sophus::Sophus)
target_link_libraries( useSophus ${Sophus_LIBRARIES} Sophus::Sophus)
Modify to
list(APPEND ALL_TARGET_LIBRARIES ${Sophus_LIBRARIES})
target_link_libraries( useSophus ${Sophus_LIBRARIES})