Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 417

Dreaded linker error. Boost and catkin_make

$
0
0
Hey there, I am creating my own package with Boost, and I have a .cpp file that is able to compile using g++ with: g++ newboost.cpp -o boost -lboost_system -lpthread But, when I try to put the .cpp file into my package and catkin_make my package, I get the following error: /usr/bin/ld: CMakeFiles/keyencelaser_node.dir/src/newboost.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status keyencelaser/CMakeFiles/keyencelaser_node.dir/build.make:95: recipe for target '/home/ateator/catkin_ws/devel/lib/keyencelaser/keyencelaser_node' failed make[2]: *** [/home/ateator/catkin_ws/devel/lib/keyencelaser/keyencelaser_node] Error 1 CMakeFiles/Makefile2:4463: recipe for target 'keyencelaser/CMakeFiles/keyencelaser_node.dir/all' failed make[1]: *** [keyencelaser/CMakeFiles/keyencelaser_node.dir/all] Error 2 Makefile:138: recipe for target 'all' failed which is a similar error to the one I got before adding the flags onto the g++ terminal command I have tried to add Boost into my CMakeLists.txt, but (although it did improve my errors), I am still left with the above errors. My CMakeLists.txt is: find_package(catkin REQUIRED COMPONENTS roscpp ) find_package( Boost REQUIRED COMPONENTS system thread ) include_directories( ${catkin_INCLUDE_DIRS} ) add_executable(keyencelaser_node src/newboost.cpp) target_link_libraries(keyencelaser_node ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ) I am pretty sure it's a linker error but I don't know how to fix it. Again, the edits I made to my CMakeLists.txt eliminated a lot of "undefined reference to" errors, but now that those are gone, I am left with the above. I appreciate any and all help. Thank you.

Viewing all articles
Browse latest Browse all 417

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>