millivanilli
millivanilli

Reputation: 25

rosrun does not work after sourcing my own catkin workspace

I'm following the ROS-tutorial and I am facing the following behavior after creating my own package: If try to execute any installed package (e.g. any_package), I get the following error:

[rosrun] Couldn't find executable named <any_package> below /opt/ros/kinetic/share/<any_package>
[rosrun] Found the following, but they're either not files
[rosrun] or not executable:
[rosrun]   /opt/ros/kinetic/share/<any_package>

Any help?

EDIT: If I execute catkin_find --without-underlays --libexec --share <any_package>, it gives me the following output:

Multiple packages found with the same name "my_package":
- my_new_package/my_package
- my_new_package/my_package_2

Upvotes: 2

Views: 2899

Answers (2)

Jitendra
Jitendra

Reputation: 69

You have to make sure you edit CmakeLists.txt according to your compile version, c++ executable declaration & Specify libraries to link a library

Below are step step modification and then run catkin_make before running your project:

step 1
add_compile_options(-std=c++11)

step 2
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
add_executable(${PROJECT_NAME}_node src/myproject_node.cpp)

step 3

## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}_node
   ${catkin_LIBRARIES}
 )

Upvotes: 0

Tik0
Tik0

Reputation: 2699

I assume that you have a tainted workspace. I assume that you've just copied the my_package to my_package_2 without editing the package.xml file in my_package_2. It is not really mentioned in the tutorial, since it assumes that you use the proper commands which creates a manifest file with a unique package name. Just edit the name-tag as follows:

<name>my_package</name>

to

<name>my_package_2</name>

in the corresponding folder.

Upvotes: 2

Related Questions