Open Jinxz666 opened 6 years ago
Take a look at FindG2O.cmake file which defines a macro to find g2o library and set their names. Almost all g2o_types_xxx are defined here. The FindG2O.cmake is in cmake_module directory of many projects that rely on g2o. For example here: https://github.com/gaoxiang12/slambook/blob/master/ch6/g2o_curve_fitting/cmake_modules/FindG2O.cmake
sudo gedit /etc/ld.so.conf
添加如下代码:
/usr/local/lib
运行:
sudo ldconfig
According to this answer, the following way also works:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
This is to temporarily add the path /usr/local/lib
to the shared library search path. You can run this command before running g2o program.
It is also possible to add this line to the end of ~/.bashrc
file, such that you don't need to run this command before running g2o program everytime.
By refering to #52 , the part of pose_estimation_3d2d & pose_estimation_3d3d should also be adjusted as following to avoid the error
target_link_libraries(…… ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY} g2o_types_sba g2o_csparse_extension)
After modifying, I can execute the code successfully. While I still wondering whether should I operate to the last two g2o libraries and what is the difference between ${G2O_CORE_LIBRARY} and g2o_core in target_link libraries.