Gazebo | Ignition | Community
Ask Your Question
1

Building gazebo plugins with eclipse

asked 2016-12-22 16:55:40 -0600

graffy gravatar image

updated 2016-12-22 16:58:02 -0600

Hello,

I'm trying to set up a gazebo plugin project under Eclipse. I'm using a simple example to try to make it work, but for some reason, it won't link against the SDFormat libararies.

I've set up the plugin and added the header files that are installed in my /user/include path, and the IDE picks them up just fine.

But, when I compile, it errors on public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);

The error is: 'ElementPtr’ in namespace ‘sdf’ does not name a type

I've provided paths to the SDFormat libraries (libsdformat.so, libsdformat.so.4, libsdformat.so.4.1.1), so it should see everything fine.

Compiling using the cmake / make process outlined in the tutorials works ok, bu tI really want to do this from an Eclipse environment.

Any tips?

The sample code:

#ifndef SONARLISTENER_H_
#define SONARLISTENER_H_

#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <sdf/Element.hh>

namespace gazebo {

class SonarListener: public gazebo::ModelPlugin {
public:

    SonarListener();
    virtual ~SonarListener();

    public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
};

}
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-01-15 19:55:49 -0600

graffy gravatar image

I'm not really sure why the errors occurred, but following the tutorial here on integrating CMake with Eclipse was a big help:

http://johnnado.com/use-cmake-with-ec...

It may have been also the need to specify the compiler switch -std=c++11 under the compiler options in the C++ preprocessor provider settings in project properties.

In any case, I eventually got it to compile and run well, and have since set up several other projects with no issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-12-22 16:55:40 -0600

Seen: 992 times

Last updated: Jan 15 '17