Why isnt my executable compiling?
So right now, I have two executables within one package. I had created the first executable a few days back. But after creating the second executable and using the catkin_make
command, only the first program gets compiled and not the second. What am I doing wrong? Is it because of the two executables within one package? Also, if I type rosrun package executable2
, I get the following error - "Couldn't find executable names executable2"
My Cmake file -
cmake_minimum_required(VERSION 2.8.3)
project(first_package)
find_package(catkin REQUIRED COMPONENTS roscpp geometry_msgs)
catkin_package()
include_directories(${catkin_INCLUDE_DIRS})
add_executable(hello hello.cpp pubvel pubvel.cpp)
target_link_libraries(hello ${catkin_LIBRARIES})
I am pretty sure the error is due to the add_executable
part of my CMakeLists.txt. hello.cpp is the first executable whereas pubvel.cpp is the second executable.
Can you update your question will your CMakeLists.txt file, and the details of the source files that are needed to compile each executable. We can't help you if we don't know how your workspace is setup.
We need to see your CMakeLists.txt. As to your last sentence, have you sourced your catkin_ws and restarted the terminal?
Hey I have updated my CMakeLists.txt. Can you please check?
This is my other workspace that I have created other than the 'catkin_ws'. And yes I have sourced it before using the catkin_make
Try the first part of my answer.
Also try adding new
add_executable
andtarget_link_libraries
for pubvel instead of merging them into one (I am not sure if you can do what you are doing).