Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 of Eclipse.

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

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.

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.


EDIT:

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

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.


EDIT:

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

EDIT 2:

There is actually a better way to solve indexing problem. Instead of doing "Add Contributed..." as described above, do Project -> Properties -> [C/C++ General] -> [Code Analysis] -> 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.

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.


EDIT:

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

EDIT 2:

There is actually a better way to solve indexing problem. Instead of doing "Add Contributed..." as described above, do Project -> Properties -> [C/C++ General] -> [Code Analysis] -> 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.