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

wpb_home_behaviors 和 wpb_home_tutorials 功能包的 OpenCV 链接问题 #8

Open
XKHoshizora opened this issue Sep 26, 2024 · 0 comments

Comments

@XKHoshizora
Copy link

XKHoshizora commented Sep 26, 2024

我在 Jetson 上编译 wpb_home_behaviors 功能包时,出现了编译错误。

从错误日志可以看出,wpb_home_behaviors 和 wpb_home_tutorials 功能包的 OpenCV 链接出现了问题,特别是以下文件中:

wpb_home_behaviors/src/wpb_home_face_detect_3d.cpp
wpb_home_behaviors/src/wpb_home_objects_3d.cpp
wpb_home_behaviors/src/wpb_home_grab_server.cpp

wpb_home_tutorials/src/wpb_home_face_detect.cpp
wpb_home_tutorials/src/wpb_home_obj_detect.cpp

这些文件都涉及到 OpenCV 的 cv::Mat 类,而链接器未能找到 cv::Mat::Mat() 的实现,说明在这些文件中 OpenCV 并未正确链接。

因此,需要将 OpenCV 库显式地链接到使用 OpenCV 的可执行文件,需要对 CMakeLists.txt 文件进行如下修改:

wpb_home_behaviors/CMakeLists.txt

target_link_libraries(wpb_home_grab_server
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

target_link_libraries(wpb_home_pass_server
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

target_link_libraries(wpb_home_objects_3d
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

target_link_libraries(wpb_home_grab_action
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

target_link_libraries(wpb_home_face_detect_3d
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

target_link_libraries(wpb_home_place_action
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

wpb_home_behaviors/CMakeLists.txt

target_link_libraries(wpb_home_face_detect
  ${catkin_LIBRARIES}
  ${OpenCV_LIBS}
)

target_link_libraries(wpb_home_obj_detect
  ${catkin_LIBRARIES}
  ${OpenCV_LIBS}
)
@XKHoshizora XKHoshizora changed the title wpb_home_behaviors 功能包的 OpenCV 链接问题 wpb_home_behaviors 和 wpb_home_tutorials 功能包的 OpenCV 链接问题 Sep 26, 2024
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

1 participant