Eclipse Neon build errors despite successful build

150 views Asked by At

I'm trying to use Eclipse to do the development for a project that involves Gazebo (a popular robotics simulator). Gazebo provides a plugin system to allow external interaction with the simulator and a series of tutorials on how to write plugins.

Having followed the tutorials successfully, I tried migrating the code to Eclipse, using cmake -G "Eclipse CDT4 - Unix Makefiles" [buildpath] to generate an eclipse rpoject, then importing it into my Eclipse workspace.

Everything generally went well, but I've run into a problem that is a bit odd:

When I compile my project, Eclipse comes back with "Member declaration not found" error referring to an SDFormat data type used in the signature to the ModelPush::Load function (see code snippets below). SDFormat, incidnetally is a robotics XML used for describing how a robot is put together.

Despite this error (which should result in nothing being built), the resulting shared library is built anyway.

I guess I can live with it, but I'd obviously like to resolve this issue, which appears to be internal to Eclipse / CDT...


TO CLARIFY:

I'm trying to determine why Eclipse gives me the error: "Member declaration not found" on the Load() function signature in model_push.cc. The guilty party is the sdf::ElementPtr _sdf parameter. Something's wrong with the SDFormat library or with the way that Eclipse / CDT looks at it. This isn't an include issue. And, even though Eclipse gives me the error, it still builds the .so file. Running make from the command line also generates the file, but without any errors.

Again, I can live with it, but I'd rather not. I just don't know where to start looking for a solution since this isn't a problem finding an include or the sdf library file.


Here's the class declaration (mode_push.hh):

#ifndef MODEL_PUSH_HH_
#define MODEL_PUSH_HH_

#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>
#include <sdf/sdf.hh>

namespace gazebo
{
class ModelPush : public ModelPlugin
{
    public:

        void Load (physics::ModelPtr _parent, sdf::ElementPtr _sdf);

        //Called by the world update start event
        void OnUpdate (const common::UpdateInfo & /*_info*/);

    //Pointer to the model
    private:
        physics::ModelPtr model;

    //Pointer to the update event connection
    private:
        event::ConnectionPtr updateConnection;
};
}

#endif /* MODEL_PUSH_HH_ */

Here's the implementation file (model_push.cc):


#include "model_push.hh"

namespace gazebo
{
void ModelPush::Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
//void ModelPush::Load (physics::ModelPtr _parent, sdf::ElementPtr /*sdf*/)
{
    //Store the pointer to the model
    this -> model = _parent;

    //Listen to the update event.  This event is broadcast every
    //simulation iteration.
    this -> updateConnection = event::Events::ConnectWorldUpdateBegin(
        boost::bind (&ModelPush::OnUpdate, this, _1));
}

//Called by the world update start event
void ModelPush::OnUpdate (const common::UpdateInfo & /*_info*/)
{
    //Apply a small linear velocity to the model.
    this -> model -> SetLinearVel (math::Vector3 (0.03, 0.0, 0.0));
}

//Register this plugin with the simulator
//GZ_REGISTER_MODEL_PLUGIN(ModelPush)
}
1

There are 1 answers

0
Tim Saucer On BEST ANSWER

I've been struggling with this exact problem. I've found a solution that works, but I still don't think is ideal. Instead of generating the eclipse project using cmake (or catkin_make) I'm generating it using the CDT project builder. Here's the process I'm using in Eclipse 2018-09.

Create a New C/C++ Project of type C++ Managed Build (A C++ Project build using the CDT's managed build system.)

Project name: ROSWorkspace Location: /home/username/eclipse-workspace/ROSWorkspace Project type: Makefile project / Empty Project Toolchain: Linux GCC

Finish.

Right click on the project and select Properties.

C/C++ Build / Builder Stetings: Uncheck "Use default build command" Build command: catkin_make Build directory: ${workspace_loc:/../catkin_ws}/

C/C++ General / Paths and Symbols / Includes tab Add /usr/include/gazebo-8 Add /usr/include/sdformat-5.3

C/C++ General / Preprocessor Includes / Providers tab CDT GCC Built-in Compiler Settings / Command to get compiler specs: ${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}" -std=c++11

Click Ok, then from the drop down menu choose: Project / C/C++ Index / Freshen all files

Ideally I'd make the time to dig in to figure out how to get the preprocessor to properly work with the generated project, but I just don't have the time right now. I hope this helps.