Install eclipse and config CDT with ROS
Sep1install JAVA
Press Ctrl+Alt+T to open terminal, followthe below steps to get started:
1.) If you’ve already installed OpenJDK inUbuntu Software Center. Remove it by running this command:
sudo apt-get purge openjdk*
2.) To add the ppa, run:
sudo add-apt-repository ppa:webupd8team/java
Then update:
sudo apt-get update
3.) To install Oracle Java 8:
sudo apt-get install oracle-java8-installer
To install Oracle Java 7:
sudo apt-get install oracle-java7-installer
To install the Java 6:
sudo apt-get install oracle-java6-installer
Sep2
1. Move the package to /opt/ folder.
# sudo mveclipse-SDK-4.2.1-linux-gtk.tar.gz /opt/
2. Use the command line to extract the tar.gzpackage.
# cd /opt/
# sudo tar xzvfeclipse-SDK-4.2.1-linux-gtk.tar.gz
3.Create a desktop file and place it into/usr/share/applications
# sudo gedit/usr/share/applications/eclipse.desktop
Copy the following to the eclipse.desktop file
[Desktop Entry] Name=eclipse Type=Application Exec=bash -i -c /opt/eclipse/eclipse Icon=/opt/eclipse/icon.xpm Terminal=false
Note:Do replace “/opt/eclipse/”with your Eclipse path. “bash-i -c /opt/eclipse/eclipse”is to source ROS and start your IDE, then your IDE will run with ROSenvironment.
Save the file, and grant it with:
sudo chmod 777 eclipse.desktop
Open the dash (Alt+F2), and search “eclipse”from it, you can see your Eclipse now:
2.Creating Eclipse project files
Go to your catkin workspace directory and runcatkin_make with options to generate Eclipse project files:(Importantfor Debug and Run)
cd ~/catkin_ws catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 .
catkin_make command will make cmake to generate severalEclipse files in the build/ folder, with these files you canimport the catkin project into Eclipse IDE.
3. Importing the project into Eclipse
Start Eclipse from your Eclipse launcher, selectFile --> Import --> Existingprojects into workspace, hit next, then browse for yourcatkin_ws directory (just select workspacedirectory). Do NOT select Copy projects intoworkspace. Then finish.
If you haven't created any package, you may followWritinga Publisher/Subscriber (C++) to create apackage with source files before we test our environment.
our project construction may be looked like this,the [Source directory] contains your source code,you may edit the code under this directory later.
You can build your project inside Eclipse withCtrl+B.
This for
-
In Eclipse, rightclick the project, click properties -> C/C++ general ->Preprocessor Include Paths, Macros etc. Click the tab "Providers"and check the box next to "CDT GCC Built-in Compiler Settings [Shared ]".
-
Afterwards, right click the project, selectIndex -> Rebuild. This will rebuild your index. Once this isdone, usually all includes will resolve.