Ask Your Question
0

problems building - executable package and dependent library package in the same catkin workspace [closed]

asked 2013-04-20 05:15:54 -0500

kurisu gravatar image

updated 2013-04-20 08:04:33 -0500

Hi,

I'm having some problems getting to grips with catkin/cmake.

Essentially I have 2 CPP packages in the same workspace: 'serial_port' - which is a library build, and 'sonar_interface' - which is an executable "driver" (depends on serial_port)

I cannot figure out how to go about setting up the CMake files to compile this workspace. At the moment I just keep getting: sonar_interface.cpp:7:27: fatal error: serial_port.hpp: No such file or directory... the offending line is just from me including serial_port.hpp: #include <serial_port.hpp>

I think this is a problem to do with me not linking properly, but I'm very new to all this so not sure where to start

Any help / tutorial links would be much appreciated,

Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2013-08-25 21:56:04

Comments

1

This is not a linker problem, but a compiler problem, probably wrong configuration of include directories. The ROS default would place includes in include/pkg, so the include should read #include "serial_port/serial_port.hpp", but I don't know how your package is layed out.

dornhege gravatar image dornhege  ( 2013-04-22 10:08:02 -0500 )edit

Please post more information about your packages, e.g. links to the repos. Than we can provide better support.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-04-30 10:26:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
-1

answered 2013-04-22 08:56:23 -0500

zumili gravatar image

Hello kurisu,

If you have a library you have to add the paths and the name of the library in your CMakeLists.txt and also all cpp or hpp files.

  • #directory where the library file is in
  • link_directories(/home/path/to/library)
  • #add the cpp files of your project
  • rosbuild_add_executable(testProject src/testProject.cpp src/sonar_interface.cpp src/serial_port.hpp ...
  • #link the library to the project (name of lib file: libtestlibrary.so.2.5.2
  • target_link_libraries (testProject testlibrary)

As you can see the library is written without the pre-string "lib" and without the version number and type at the end.

Best regards, zumili

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-04-20 05:15:54 -0500

Seen: 171 times

Last updated: Apr 22 '13