Ask Your Question

Revision history [back]

The most likely reason is that catkin_make coalesces all projects (ie: ROS packages) into a single build (equivalent to calling add_subdirectory(..)) whereas catkin_tools (which supplies the catkin command) builds all packages in isolation.

When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".

However, when I use 'catkin build' to build my workspace, I get the following error message:

So with catkin_make, test_func() is defined (and declared) in the same build context, while with catkin_tools, test_func() only exists within the context in which function_maker is processed.

This leads to test_func() being an unknown symbol in the latter case, hence the error message.

How can I make this work with both build tools?

One approach could be to use the CFG_EXTRAS argument of the catkin_package(..) macro (documentation).

This would allow you to export the function in such a way that its definition (and declaration) are imported into the build context of function_user, provided function_user properly find_package(..)s function_maker.

There are various Q&As on ROS Answers about this, see #q173947, #q173683 and #q275318 for instance.

The most likely reason is that catkin_make coalesces all projects (ie: ROS packages) into a single build (equivalent to calling add_subdirectory(..)) whereas catkin_tools (which supplies the catkin command) builds all packages in isolation.

When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".

However, when I use 'catkin build' to build my workspace, I get the following error message:

So with catkin_make, test_func() is defined (and declared) in the same build context, while with catkin_tools, test_func() only exists within the context in which function_maker is processed.

This leads to test_func() being an unknown symbol in the latter case, hence the error message.

How can I make this work with both build tools?

One approach could be to use the CFG_EXTRAS argument of the catkin_package(..) macro (documentation).

This would allow you to export the function in such a way that its definition (and declaration) are imported into the build context of function_user, provided function_user properly find_package(..)s function_maker.

There are various Q&As on ROS Answers about this, see #q173947, #q173683, #q93266 and #q275318 for instance.

The most likely reason is that catkin_make coalesces all projects (ie: ROS packages) into a single build (equivalent to calling add_subdirectory(..)) whereas catkin_tools (which supplies the catkin command) builds all packages in isolation.

When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".

However, when I use 'catkin build' to build my workspace, I get the following error message:

So with catkin_make, test_func() is defined (and declared) in the same build context, while with catkin_tools, test_func() only exists within the context in which function_maker is processed.

This leads to test_func() being an unknown symbol in the latter case, hence the error message.

How can I make this work with both build tools?

One approach could be to use the CFG_EXTRAS argument of the catkin_package(..) macro (documentation).

This would allow you to export the function in such a way that its definition (and declaration) are imported into the build context of function_user, provided function_user properly find_package(..)s function_maker.

There are various Q&As on ROS Answers about this, see #q173947, #q173683, #q93266 and #q275318 for instance.

The most likely reason is that catkin_make coalesces all projects (ie: ROS packages) into a single build (equivalent to calling add_subdirectory(..)) whereas catkin_tools (which supplies the catkin command) builds all packages in isolation.

(Edit: including @Dirk Thomas' comment) Refer to Migrating from catkin_make in the catkin_tools documentation for more information on the differences between catkin_make and catkin_tools.

When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".

However, when I use 'catkin build' to build my workspace, I get the following error message:

So with catkin_make, test_func() is defined (and declared) in the same build context, while with catkin_tools, test_func() only exists within the context in which function_maker is processed.

This leads to test_func() being an unknown symbol in the latter case, hence the error message.

How can I make this work with both build tools?

One approach could be to use the CFG_EXTRAS argument of the catkin_package(..) macro (documentation).

This would allow you to export the function in such a way that its definition (and declaration) are imported into the build context of function_user, provided function_user properly find_package(..)s function_maker.

There are various Q&As on ROS Answers about this, see #q173947, #q173683, #q93266 and #q275318 for instance.