Ask Your Question
0

How to solve ‘add_dependencies Adding dependency to non-existent target:...’

asked 2015-11-06 21:07:11 -0500

ChenJinluo gravatar image

updated 2015-11-06 21:08:26 -0500

Ubuntu: 12.04

ROS: Hydro

I learn to write .cfg file according to WiKilink text

After I finished it and ran catkin_make, error occurred.

 add_dependencies Adding dependency to non-existent target: example_node

How can I solve it ? Thank you ~

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2015-11-07 06:03:11 -0500

Dimitri Schachmann gravatar image

Well, do you have an example_node?

The line

add_dependencies(example_node ${PROJECT_NAME}_gencfg)

ensures, that the the target "example_node" is built after the target ${PROJECT_NAME}_gencfg. If you did not create this target before, you get your error.

In this context: If you don't have any node using your .cfg, then just delete this line. BUT what good is a .cfg file for, if you don't use it in a node?! So I assume that sooner or later you will create a node that will use your .cfg and then you need to make sure the .cfg is processed before the node is built.

Assuming you use c++ for your nodes:

add_executable(my_node src/my_node.cpp)
add_dependencies(my_node ${PROJECT_NAME}_gencfg)

Replace my_node by whatever your node is called and src/my_node.cpp by the according source file.

edit flag offensive delete link more

Comments

Thanks a lot ! The procedure in ROS Wiki confused me. I should catkin_make first to generate the xx.Config.h file, then add_dependencies(example_node ${PROJECT_NAME}_gencfg) to make my .cpp file. Then it works. Thanks very much~

ChenJinluo gravatar image ChenJinluo  ( 2015-11-08 01:33:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-06 21:07:11 -0500

Seen: 5,411 times

Last updated: Nov 07 '15