RainerKuemmerle / g2o

g2o: A General Framework for Graph Optimization
3.1k stars 1.11k forks source link

undefined reference to `vtable for g2o::VertexPointXYZ' #724

Closed DizkiBorsuk closed 1 year ago

DizkiBorsuk commented 1 year ago

Hi, I'm trying to use g2o::VertexPointXYZ but i'm getting this error:

warning: relocation against _ZTVN3g2o14VertexPointXYZE' in read-only section.text._ZN3g2o14VertexPointXYZC2Ev[_ZN3g2o14VertexPointXYZC5Ev]' [build] ...: in function g2o::VertexPointXYZ::VertexPointXYZ()': [build] /usr/local/include/g2o/types/slam3d/vertex_pointxyz.h:41: undefined reference tovtable for g2o::VertexPointXYZ' [build] /usr/bin/ld: /usr/local/include/g2o/types/slam3d/vertex_pointxyz.h:41: undefined reference to `vtable for g2o::VertexPointXYZ' [build] /usr/bin/ld: warning: creating DT_TEXTREL in a PIE

Thanks for help in advance

rohanx01 commented 1 year ago

make sure vertex_pointxyz.cpp is compiled simultaneously with your code.. for eg: use g++ vertex_pointxyz.cpp your_file.cpp -o my_program then run ./my_program

DizkiBorsuk commented 1 year ago

That worked, thank you