Ask Your Question
0

How to link headerfile and sourcefile by C++

asked 2016-08-29 07:29:32 -0500

sasadasd gravatar image

updated 2016-08-29 16:25:36 -0500

Hello,

I would like to divide programs into source files and header files in src folder. What do I need to link the some code ? Do I need to edit CMakeLists.txt?

For example :ekf_localization https://github.com/cra-ros-pkg/robot_...

There are many programs in src folder and they are capable of linking one another. What do I need to link to some proglams such as them?

Please let me know.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-08-29 20:00:26 -0500

For source code to find header files, the CMakeLists.txt needs to be changed.

For example if your package formate is

dummy_pkg/
   src/
   include/
   CmakeLists.txt
   package.xml

Then in your CMakeLists.txt, you need to add

include_directories(
  include
)

will include header files in the include/ directory. If you are looking for headers in other ros packages then also add ${catkin_INCLUDE_DIRS} inside those brackets.

edit flag offensive delete link more

Comments

Thank you so much !!

sasadasd gravatar image sasadasd  ( 2016-09-03 03:43:56 -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: 2016-08-29 07:29:32 -0500

Seen: 78 times

Last updated: Sep 03 '16