Robotics StackExchange | Archived questions

Building gazebo plugins with eclipse

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);
};

}

Asked by graffy on 2016-12-22 17:55:40 UTC

Comments

Answers

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-eclipse/

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.

Asked by graffy on 2017-01-15 20:55:49 UTC

Comments