CMake cannot find source file
Hi guys,
I'm using ROS kinetic on a Navio2 board, and I've been working on a project in a catkin workspace. I edited the CMakeLists.txt file to add an executable, but every time I attempt to run catkin_make, I get the following error:
CMake Error at link/CMakeLists.txt:201 (add_executable):
Cannot find sourcefile:
link/src/roscomm.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
CMake Error: CMake can not determine linker language for target: roscomm
CMake Error: Cannot determine link language for target "roscomm".
-- Generating done
-- Build files have been written to: /home/pi/ros_ws/build
Invoking "cmake" failed
I know for sure that this file exists, and I've tried using just roscomm.cpp instead of link/src/roscomm.cpp.
Edit:
The full path is ~/ros_ws/src/link/src/roscomm.cpp
The CMakeLists.txt is as follows:
cmake_minimum_required(VERSION )
project(link)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
sensor_msgs
std_msgs
)
catkin_package()
include_directories(
${catkin_INCLUDE_DIRS}
)
add_executable(roscomm link/src/roscomm.cpp)
target_link_libraries(roscomm ${catkin_INCLUDE_DIRS})
Any help would be great, thanks
Source file locations are always specified relative to the
CMakeLists.txt
that uses them, so what is the path toroscomm.cpp
relative tolink/CMakeLists.txt
?it might help if you show us your
CMakeLists.txt
(ie: the one in thelink
directory).The full path is ~/ros_ws/src/link/src/roscomm.cpp I've edited the original text so that it can all fit in one place
Please add this information to your original question text. Use the
edit
button/link for that. Comments are too limited.