Home | Tutorials | Wiki | Issues
Ask Your Question

libraries in eclipse

asked 2013-07-10 04:12:47 -0600

atenea gravatar image


I am trying to set the libraries and include paths for Gazebo in eclipse but I am not sure how it should be done. Does anybody know which Path and Symbols configuration is needed?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-11 06:23:57 -0600

Boris gravatar image

updated 2013-07-31 11:00:11 -0600

If you followed Gazebo tutorials you should have a CMake project. Thus, you can generate Eclipse project with all necessary paths and symbols automagically by:

$ cd build
$ cmake -G"Eclipse CDT4 - Unix Makefiles" ../

As a result you will get .project and .cproject files in the build directory. Just import the project into Eclipse workspace (File -> Import -> Existing Projects into Workspace -> Select root directory (choose build directory in dialog)).

However, sometimes for code completion to work it is necessary to add additional symbols and paths. That can be done by the following sequence: Project -> Properties -> C/C++ Include Paths and Symbols -> Add Contributed... -> Discovered scanner configuration container, Next -> Next -> Select everything (yes, by hand) in "C/C++ Container path" -> Finish. It can be tiresome, but eventually it helps.

Also you may need to try to compile project at least once, thus Eclipse gather output information from compiler.

Note: The next problem you may face is "Out of memory" error while sources are indexing. In short, Eclipse allocate 256 Mb of memory (or so) by default. Which seems ridiculously small for Java VM, and you have to give it more to cope with Gazebo sources. Here you can read how to do it. To permanently save these settings edit eclipse.ini appropriately in the root directory of Eclipse.

P.S. That all works for sure on Juno, but should be pretty similar on Indigo.


The libraries can be added by using target_link_libraries in CMakeLists.txt

Note: It is necessary to re-generate Eclipse project files every time you change CMakeLists.txt


There is actually a better way to solve indexing problem. Instead of doing "Add Contributed..." as described above, do Project -> Properties -> [C/C++ General] -> Preprocessor Include Paths, Macros etc. -> (Choose tab "Providers"), tick "CDT GCC Built-in Compiler Settings" and, possibly, "CDT GCC Build Output Parser". This one definitely works in Eclipse Kepler, but I'm not sure for previous versions.

edit flag offensive delete link more


Thanks for your answer, but I had a problem when following the steps you mentioned. When I get to "C/C++ Container path" the list is empty, and I cannot finish the configuration. Any ideas why?

atenea gravatar imageatenea ( 2013-07-17 02:46:24 -0600 )edit

So... I got it! But I still have problems. Like "Symbol ModelPlugin could not be resolved". Is there any other configuration to change in the project?

atenea gravatar imageatenea ( 2013-07-18 06:32:08 -0600 )edit

So... now it worked. I just did all over again. Don't know what was wrong before. Thanks!

atenea gravatar imageatenea ( 2013-07-18 09:17:25 -0600 )edit

Glad it helped. The last resort is usually to delete `build` directory and start over, and it is usually the way for catkin packages in ROS. Sorry, didn't get any notification of your comments before.

Boris gravatar imageBoris ( 2013-07-18 14:23:45 -0600 )edit

That's what I did. Thanks again.

atenea gravatar imageatenea ( 2013-07-19 04:47:46 -0600 )edit
Login/Signup to Answer

Question Tools



Asked: 2013-07-10 04:12:47 -0600

Seen: 1,334 times

Last updated: Jul 31 '13