1. 程式人生 > >ROS中編譯通過但是遇到可執行檔案找不到的問題

ROS中編譯通過但是遇到可執行檔案找不到的問題

反覆查詢問題,發現是CMakeLists 中的宣告順序有問題,要先宣告catkin_package(),再宣告add_executable()改成這樣就好了:
cmake_minimum_required(VERSION 2.8.3)
project(XXX)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")

find_package(catkin REQUIRED COMPONENTS
 XXX
)
catkin_package(
  CATKIN_DEPENDS
 XXX
  ${CATKIN_DEPS} ${ROSDEP_DEPS}
)
include_directories(

   include
  ${catkin_INCLUDE_DIRS}
)
add_executable(
XXX
)
target_link_libraries(
XXX
${catkin_LIBRARIES}
)