Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgrasp_candidates_generator.so:对‘boost::this_thread::hidden::sleep_until(timespec const&)’未定义的引用 #14

Open
nuo-code opened this issue Jan 5, 2022 · 3 comments

Comments

@nuo-code
Copy link

nuo-code commented Jan 5, 2022

Hello, I encountered an error when using your library,libgrasp_candidates_generator.so:对‘boost::this_thread::hidden::sleep_until(timespec const&)’未定义的引用,My boost library version is 1.65.1,Can you give me some help?

@sashaiw
Copy link

sashaiw commented Mar 21, 2022

I had a similar problem and was able to resolve it by adding the following include directive to src/gpg/plot.cpp:

#include <boost/thread/thread.hpp>

After this I still had some linking errors for Boost libraries:

/usr/bin/ld: libgrasp_candidates_generator.so: undefined reference to `boost::this_thread::interruption_point()'
/usr/bin/ld: libgrasp_candidates_generator.so: undefined reference to `boost::detail::get_current_thread_data()'

I resolved these errors by adding the following lines to my CMakeLists.txt:

# Boost
find_package(Boost REQUIRED COMPONENTS thread)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
add_definitions(-DBOOST_ALL_DYN_LINK)

# after add_executable() with the other target_link_libraries()
target_link_libraries(${PROJECT_NAME}_grasp_candidates_generator ${Boost_LIBRARIES})

I do not know if this is the correct solution to this problem nor have I tested the library yet but it allowed me to finish the build without errors. I am on Ubuntu 20.04 with Boost 1.71.

@nuo-code
Copy link
Author

nuo-code commented Mar 22, 2022 via email

@Chan7348
Copy link

Chan7348 commented Sep 1, 2023

ye u r right thanks bro!!!

I had a similar problem and was able to resolve it by adding the following include directive to src/gpg/plot.cpp:

#include <boost/thread/thread.hpp>

After this I still had some linking errors for Boost libraries:

/usr/bin/ld: libgrasp_candidates_generator.so: undefined reference to `boost::this_thread::interruption_point()'
/usr/bin/ld: libgrasp_candidates_generator.so: undefined reference to `boost::detail::get_current_thread_data()'

I resolved these errors by adding the following lines to my CMakeLists.txt:

# Boost
find_package(Boost REQUIRED COMPONENTS thread)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
add_definitions(-DBOOST_ALL_DYN_LINK)

# after add_executable() with the other target_link_libraries()
target_link_libraries(${PROJECT_NAME}_grasp_candidates_generator ${Boost_LIBRARIES})

I do not know if this is the correct solution to this problem nor have I tested the library yet but it allowed me to finish the build without errors. I am on Ubuntu 20.04 with Boost 1.71.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants