解决 undefined reference to `g2o::VertexSE3Expmap::VertexSE3Expmap()‘

There is a problem when using g2o, that is, you will encounter:
undefined reference to `g2o::VertexSE3Expmap::VertexSE3Expmap()'

undefined reference to `g2o::VertexSBAPointXYZ::VertexSBAPointXYZ()’

undefined reference to `g2o::EdgeProjectXYZ2UV::EdgeProjectXYZ2UV()’

undefined reference to `typeinfo for g2o::VertexSBAPointXYZ’

undefined reference to `typeinfo for g2o::VertexSE3Expmap’

undefined reference to `typeinfo for g2o::VertexSE3Expmap’

I have set the list in cmakelist
(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
and I can use my own designed vertex vertex and edge. What is the reason for this? Is it because of cmakelist?

Add the bold part at the end of cmakelist.
target_link_libraries(BA “/usr/local/lib/libg2o_core.so”
“/usr/local/lib/libg2o_stuff.so”
g2o_types_sba
${Sophus_LIBRARIES})

Guess you like

Origin blog.csdn.net/qq_41873057/article/details/115740822