Ask Your Question
0

pluginlib Tutorial - polygon_base.h not found

asked 2014-02-16 23:39:16 -0500

bnm-rc gravatar image

Hi everyone,

I'm facing an error when trying to build the tutorial on the pluginlib.
I updated my CMakeLists.txt, package.xml and created a polygon_loader.xml as described in the tutorial, but when I try to build the project, it fails stating that in [my_workspace]/pluginlib_tutorials_/src/polygon_loader.cpp the included header file pluginlib_tutorials_/polygon_base.h could not be found.

The funny thing is, if I change my CMakeLists.txt by adding the line

 target_link_libraries(polygon_loader polygon_plugins)

my polygon_loader.cpp is fine, but my polygon_plugins.cpp throws the previous mentioned error. It seems I missed some configuring in the ROS toolchain I guess. Could please someone help me out?

Thanks in advance,
Roberto

P.S.: Here are the relevant fragments, if something is missing, please ask!

My file structure:

catkin_ws_plugins/
-> build
-> devel
-> src
--> CMakeList.txt
--> pluginlib_tutorials_
---> CMakeLists.txt
---> package.xml
---> polygon_plugins.xml
---> include
----> pluginlib_tutorials_
-----> polygon_base.h
-----> polygon_plugins.h
---> src
-----> polygon_loader.cpp
-----> polygon_plugins.cpp

catkin_ws_plugins/src/pluginlib_tutorials_/CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(pluginlib_tutorials_)
find_package(catkin REQUIRED COMPONENTS
    pluginlib
    roscpp
)
catkin_package()
include_directories(
    ${catkin_INCLUDE_DIRS}
)
add_library(polygon_plugins src/polygon_plugins.cpp)
add_executable(polygon_loader src/polygon_loader.cpp)
target_link_libraries(polygon_loader ${catkin_LIBRARIES})

catkin_ws_plugins/src/pluginlib_tutorials_/package.xml (only the changes):

<export>
    <pluginlib_tutorials_ plugin="${prefix}/polygon_plugins.xml" />
</export>

catkin_ws_plugins/src/pluginlib_tutorials_/polygon_plugins.xml:

<library path="lib/libpolygon_plugins">
    <class type="polygon_plugins::Triangle" base_class_type="polygon_base::RegularPolygon">
         <description>This is a triangle plugin</description>
    </class>
    <class type="polygon_plugins::Square" base_class_type="polygon_base::RegularPolygon">
         <description>This is a square plugin</description>
    </class>
</library>

Last but not least the line where the error occurs in
catkin_ws_plugins/src/pluginlib_tutorials_/src/polygon_loader.cpp

#include <pluginlib_tutorials_/polygon_base.h>
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-03-03 01:27:10 -0500

tfoote gravatar image

You need to add your local include directory to the include_directories in your CMakeLists.txt

It shold look more like:

include_directories(
    include
    ${catkin_INCLUDE_DIRS}
)
edit flag offensive delete link more
0

answered 2015-01-15 10:16:07 -0500

acp gravatar image

well, just put the full path of the library

#include <~/catkin_ws/src/pluginlib_tutorials_/include/pluginlib_tutorials_/polygon_base.h>

edit flag offensive delete link more

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: 2014-02-16 23:39:16 -0500

Seen: 227 times

Last updated: Mar 03 '15