How To Install Eclipse for C++ On Ubuntu
It provides all the steps required to install Eclipse for C++ and C development on Ubuntu and getting started with C/C++ development using the Hello World Project
Eclipse is widely used to develop applications using Java, PHP, and C/C++ as the programming languages. It's one of the most popular open-source IDE among the developers. This tutorial provides all the steps required to install Eclipse for C/C++ Developers to develop applications in C or C++.
In this tutorial, we will discuss how to install Eclipse for C++ or C development on the popular Linux distribution i.e. Ubuntu. It provides several features for C/C++ development including IntelliSense, Debugging, etc. This tutorial provides all the steps required to install Eclipse on Ubuntu 18.04 LTS, though the steps should be similar for other Linux systems.
Notes: It assumes that GCC is already installed on the system. You may also be interested in How To Install GCC On Ubuntu 18.04 LTS to install the latest GCC on the popular Debian based Linux distribution - Ubuntu.
Step 1 - Download Eclipse
Open the Eclipse Packages Page to view the various packages distributed by the Eclipse Foundation. It shows the package for C/C++ as shown in Fig 1.
Click on the 64-bit for Windows option as highlighted in Fig 1. It will navigate to the Downloads Page as shown in Fig 2.
Click on the Download Button to start the download. You may also choose other mirror sites as listed on the Downloads Page.
Step 2 - Install Eclipse
In this step, we will install Eclipse for C/C++ Developers using the zip downloaded in the previous step. Extract the download to your preferred location having sufficient space on the disk. The extract will look like the one as shown in Fig 3.
Step 3 - Desktop Shortcut
In this step, we will create the desktop shortcut to execute it from the desktop using the executable available in the bin directory.
We will install the GNOME panel and use the same to create a desktop shortcut to execute the Eclipse installed by us in previous steps.
# Refresh Packages Index
sudo apt-get update
# Install GNOME Panel
sudo apt-get install --no-install-recommends gnome-panel
# Create Desktop icon
gnome-desktop-item-edit ~/Desktop/ --create-new
Now configure the Eclipse installation as shown in Fig 4. We will use the Eclipse icon available in the root of the installation directory.
Step 4 - Launch Eclipse
Now execute the Eclipse using the executable. In case you execute it using the desktop shortcut, it will ask for system permission as shown in Fig 5.
The launcher will also complain about missing JRE in case Java is not installed on the system as shown in Fig 6.
It will ask to choose the workspace as shown in Fig 7.
Choose appropriate workspace location and click on the Launch Button to launch Eclipse. Also, make sure to uncheck the checkbox as highlighted in Fig 4 to show the Workspace Selection Option at the start of Eclipse. It will show the welcome screen as shown in Fig 8.
Close the Welcome Screen to view the default layout of the Workspace for C/C++ as shown in Fig 9.
Step 5 - Getting started with C++ - Hello World
In this step, we will create the hello.
The New Project Dialog will show options to choose Project Type as shown in Fig 10.
I have selected C++ Project as highlighted in Fig 10. Now click on the Next Button to configure the Project as shown in Fig 11.
I have selected an Empty Executable Project with Linux GCC as highlighted in Fig 11. Right-click on the Project, hover over New Option and click on the Source File Option.
It will show options to configure the File as shown in Fig 12.
Now click on the Finish
Right-click the project and choose the option Build Project. It will show the build results on the Console as shown in Fig 14.
Now again right-click the project and choose the option to run it as a local application. After executing successfully, it will show the result on the console as shown in Fig 15.
Step 6 - Getting started with C - Hello World
In this step, we will create the hello.c file and update it to print Hello World on the Console.
Create a C Project with the name HelloC following the same steps as we did for C++ Project. Also, create a file hello.c with the source code as shown in Fig 16.
Follow the same steps as we did with HelloCPP Project to build and execute it as Local Application. It will show the output as shown in Fig 17 and Fig 18.
This is how we can install Eclipse for C and C++. We have also created the projects for C and C++, built and executed the simple programs to print Hello World on the console.