无法使用 fcl 库找到 -lfcl
cannot find -lfcl using fcl library
我想 运行 使用 fcl 库的 ROS 节点。我刚刚写了一小段代码并编辑了 CMakeLists.txt 以确保我可以 运行 节点但是我收到以下错误:
/usr/bin/ld: cannot find -lfcl
collect2: error: ld returned 1 exit status
我该怎么办?
我的CMakeLists.txt如下:
cmake_minimum_required(VERSION 2.8.3)
project(package_name)
find_path(FCL_INCLUDE_DIRS
NAMES fcl/collision.h
HINTS ${PC_FCL_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include")
find_package(catkin REQUIRED COMPONENTS
nav_msgs
roscpp
sensor_msgs
visualization_msgs
tf
dynamic_reconfigure
message_generation
laser_geometry
geometry_msgs
cmake_modules
)
find_package(Boost REQUIRED)
find_package(Eigen REQUIRED)
find_package(PCL REQUIRED)
find_package(OpenCV REQUIRED)
find_package(fcl REQUIRED)
generate_dynamic_reconfigure_options(
)
generate_messages(
DEPENDENCIES
geometry_msgs sensor_msgs nav_msgs visualization_msgs
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${haptic_teleoperation}
CATKIN_DEPENDS message_runtime nav_msgs roscpp sensor_msgs
DEPENDS eigen
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(include
${catkin_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${FCL_INCLUDE_DIRS}
)
## Declare a cpp library
add_library()
add_executable(fcl_test src/fcl_test.cpp)
add_dependencies(fcl_test
${PROJECT_NAME}_gencfg
${PROJECT_NAME}_generate_messages_cpp
)
target_link_libraries(fcl_test
fcl
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
)
在link命令中用${fcl_LIBRARIES}
替换fcl
:
target_link_libraries(fcl_test
${fcl_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
)
如果find_package(fcl REQUIRED)
工作正常,这个变量应该被自动设置。
我想 运行 使用 fcl 库的 ROS 节点。我刚刚写了一小段代码并编辑了 CMakeLists.txt 以确保我可以 运行 节点但是我收到以下错误:
/usr/bin/ld: cannot find -lfcl
collect2: error: ld returned 1 exit status
我该怎么办?
我的CMakeLists.txt如下:
cmake_minimum_required(VERSION 2.8.3)
project(package_name)
find_path(FCL_INCLUDE_DIRS
NAMES fcl/collision.h
HINTS ${PC_FCL_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include")
find_package(catkin REQUIRED COMPONENTS
nav_msgs
roscpp
sensor_msgs
visualization_msgs
tf
dynamic_reconfigure
message_generation
laser_geometry
geometry_msgs
cmake_modules
)
find_package(Boost REQUIRED)
find_package(Eigen REQUIRED)
find_package(PCL REQUIRED)
find_package(OpenCV REQUIRED)
find_package(fcl REQUIRED)
generate_dynamic_reconfigure_options(
)
generate_messages(
DEPENDENCIES
geometry_msgs sensor_msgs nav_msgs visualization_msgs
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${haptic_teleoperation}
CATKIN_DEPENDS message_runtime nav_msgs roscpp sensor_msgs
DEPENDS eigen
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(include
${catkin_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${FCL_INCLUDE_DIRS}
)
## Declare a cpp library
add_library()
add_executable(fcl_test src/fcl_test.cpp)
add_dependencies(fcl_test
${PROJECT_NAME}_gencfg
${PROJECT_NAME}_generate_messages_cpp
)
target_link_libraries(fcl_test
fcl
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
)
在link命令中用${fcl_LIBRARIES}
替换fcl
:
target_link_libraries(fcl_test
${fcl_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
)
如果find_package(fcl REQUIRED)
工作正常,这个变量应该被自动设置。