g2o icon indicating copy to clipboard operation
g2o copied to clipboard

compile and install g2o with OpenMP, but build my program with error undefined reference to symbol 'omp_set_lock@@OMP_3.0'

Open charon-cheung opened this issue 2 years ago • 2 comments

/usr/bin/ld: CMakeFiles/ls_slam_g2o.dir/src/main.cpp.o: undefined reference to symbol 'omp_set_lock@@OMP_3.0'
//usr/lib/x86_64-linux-gnu/libgomp.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

void lock() { omp_set_lock(&_lock); } is defined in openmp_mutex.h, how to solve this ?

charon-cheung avatar Sep 17 '22 10:09 charon-cheung

https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html Try to add openmp on your target. g2o misses to correctly export the OpenMP flags.

RainerKuemmerle avatar Sep 17 '22 14:09 RainerKuemmerle

https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html Try to add openmp on your target. g2o misses to correctly export the OpenMP flags.

catkin_make done, but it that all ? Do I need to edit my cpp code?

charon-cheung avatar Sep 19 '22 09:09 charon-cheung