我无法理解以下CMakeLists.txt文件符合但未运行的原因。我得到的错误是:
[rosrun]找不到名为main_GUI1的可执行文件/ home / jay / fuerte / sandbox / tum_ardrone
我的CMakeLists.txt(很抱歉将其全部包含在内,但这是我认为最好的方式):
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE RelWithDebInfo)
rosbuild_init()
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# ------------------- add dynamic reconfigure api ------------------------------------
rosbuild_find_ros_package(dynamic_reconfigure)
include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
gencfg()
# ------------------- add common files ------------------------------------
set(COMMON_SOURCE_FILES
src/UINode/tum_ardrone_gui.cpp
src/UINode/RosThread.cpp
src/UINode/PingThread.cpp
)
set(COMMON_HEADER_FILES
src/UINode/tum_ardrone_gui.h
src/UINode/RosThread.h
src/UINode/PingThread.h
)
#------------------set required libs and headers---------------------------
include_directories(
${PROJECT_SOURCE_DIR}/thirdparty/TooN/include
${PROJECT_SOURCE_DIR}/thirdparty/libcvd/include
${PROJECT_SOURCE_DIR}/thirdparty/gvars3/include
)
link_directories(
${PROJECT_SOURCE_DIR}/thirdparty/libcvd/lib
${PROJECT_SOURCE_DIR}/thirdparty/gvars3/lib
)
# ---------------------------- TEST --------------------------------------------------
# set header and source files
set(GUIA_SOURCE_FILES
${COMMON_SOURCE_FILES}
src/commands/main_GUI1.cpp
)
set(GUIA_HEADER_FILES
${COMMON_HEADER_FILES}
src/pathplanning/AStarAlgorithm.h
)
# *.ui
set(GUIA_UI_FILES
src/UINode/tum_ardrone_gui.ui
)
# *.qrc
set(GUIA_RESOURCE_FILES
)
# do QT stuff
ADD_DEFINITIONS( -Wall ) #this is fine
find_package(Qt4 REQUIRED) #this is fine
include(${QT_USE_FILE}) #this is fine
QT4_ADD_RESOURCES(GUIA_RESOURCE_FILES_CPP ${GUIA_RESOURCE_FILES}) #this is fine
QT4_WRAP_UI(GUIA_UI_FILES_HPP ${GUIA_UI_FILES}) #this is fine
QT4_WRAP_CPP(GUIA_HEADER_FILES_HPP ${GUIA_HEADER_FILES}) #error goes if i remove include_directories(${CMAKE_CURRENT_BINARY_DIR}) above
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# build!
rosbuild_add_executable(main_GUI1 ${GUIA_SOURCE_FILES} ${GUIA_RESOURCE_FILES_CPP} ${GUIA_UI_FILES_HPP} ${GUIA_HEADER_FILES_HPP})
target_link_libraries(main_GUI1 ${QT_LIBRARIES} cvd)
# ---------------------------- Messages & Services --------------------------------------------------
#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
rosbuild_gensrv()
我在src /命令中有main_GUI1.cpp,所以我不知道为什么会出现这个错误。提前谢谢!