ros 运行 在 catkin build 和 source 后找不到可执行文件

ros run couldn't find executable file after catkin build and source

我正在尝试 运行 一个可执行文件,但出现以下错误,我 运行

catkin build

然后

source ~/emvs_ws/devel/setup.bash

在此之后 运行以下命令显示此消息

rosrun mapper_emvs run_emvs

错误是

[rosrun] Couldn't find executable named run_emvs below /home/ubuntu/emvs_ws/src/rpg_emvs/mapper_emvs

这是 cmake 文件:

project(mapper_emvs)
cmake_minimum_required(VERSION 2.8.3)

find_package(catkin_simple REQUIRED)
catkin_simple(ALL_DEPS_REQUIRED)

set(CMAKE_BUILD_TYPE RelWithDebInfo) # Release, RelWithDebInfo
set(CMAKE_CXX_FLAGS "-O3 -fopenmp -std=c++11 ${CMAKE_CXX_FLAGS}")

set(HEADERS
  include/mapper_emvs/mapper_emvs.hpp
  include/mapper_emvs/data_loading.hpp
  include/mapper_emvs/depth_vector.hpp
  include/mapper_emvs/trajectory.hpp
  include/mapper_emvs/geometry_utils.hpp
  include/mapper_emvs/median_filtering.hpp
)

set(SOURCES
  src/mapper_emvs.cpp
  src/data_loading.cpp
  src/median_filtering.cpp
)

option(DEFINE_USE_INVERSE_DEPTH "Use linear spacing in inverse depth (if OFF, will use linear spacing in depth)" ON)
if(DEFINE_USE_INVERSE_DEPTH)
    add_definitions(-DUSE_INVERSE_DEPTH)
endif(DEFINE_USE_INVERSE_DEPTH)

cs_add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})

# Executables
################################################################################

cs_add_executable(run_emvs src/main.cpp)
target_link_libraries(run_emvs ${PROJECT_NAME})

################################################################################
cs_install()
cs_export()

我对 catkin build 不是很熟悉,但我很高兴 catkim_make 解决了您的问题。

回答你的第二个问题,这意味着这个头文件incremental_registration.h不在你的程序正在寻找它的地方。但是,我建议您关闭此问题并创建另一个问题,因为它们不相关。

通过将以下行添加到 CMakeLists.txt 使其工作:

catkin_package()