Using Eclipse For C/C++ Programming

Some people think that Eclipse is only for Java Programming and Development but that is not correct. Some people do not know how to use Eclipse for C/C++ Programming but I am here to help you guys to solve this problem.

There are lots of articles on this but they do not provide the solution. Moreover, there are lots of IDE for C/C++ Programming but I am going to tell why I choose Eclipse in brief.


Pros of using Eclipse

  • Eclipse organizes, imports well, and does a really good job in presenting different programming languages like Java, C++.
  • Eclipse auto formats source code allowing customization and increased readability for the user.
  • Eclipse automatically reports errors to the user rather than logging it to the console.
  • Eclipse has lots of coding shortcuts and auto-correction features allowing faster development of software.

Everything has Pros and Cons as well


Cons of using Eclipse

  • Syntax prediction tools are not better in Eclipse than other IDE products.
  • Starting Eclipse always takes a long time, it consumes a lot of memory and sometimes runs very slowly.
  • Visual Studio Code has many features and Extensions while Eclipse has very few.

Some other IDEs for C/C++ Programming

Microsoft Visual Studio, NetBeans, Dev-C++, Visual Studio Code, Code:: Blocks, CLion, CodeLite…… and many more.


Process of using Eclipse for C/C++ Development


1. Firstly, download and install Java Standard Edition (Java SE) by visiting the original site. Link to JDK is provided at last. Click on JDK Download. And download the Java SE Development Kit according to the need of your system.


2. Now after installing the JDK, add the path of JDK/bin to the System Variables. Like ( 'C:\Program Files\Java\jdk-14.0.2\bin') in my case the JDK version is 14.0.2.


3. Now It's time to install Eclipse IDE for C/C++ Developers. Link to Eclipse IDE for C/C++ Developer is provided at last. Download the IDE and start installing the Eclipse IDE. Important:- Eclipse IDE needs a JDK version greater than 13.


4. Select the Installation Folder and start Installing Eclipse IDE for C/C++ Developer. After Installation click on Launch and set the Workspace. Now from here most important thing is to run C/C++ programs comes.
5. Now let's first understand the problem. Launch the Eclipse IDE and in the project-explorer click on 'Create a new C or C++ Project'. On Clicking it, the prompt will be opened. In that prompt select 'All - C++ Managed Build'. Now give a project name and under project type select 'Executable Hello world C++ project' and under Toolchain select 'Cross GCC'. Then click next, next….. and at last finish.


6. The main problem is g++ is not present in the path. We have to add it to our system to use Eclipse for C/C++ Programming.


7. Now it's time to solve this issue. Firstly you have to download MinGW - Minimalist GNU for your platform. The download link is provided at the end of the Article.
8. After downloading MinGW we have to install it. Select the location where you want to install MinGW and click continue. It will download some files when finished after that click 'continue'.
9. Then you have to select some packages that are to be installed for working of MinGW. Those packages are mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++, msys-base. After selecting all these packages click on Installation at the top. In Installation click 'Apply Changes'.


10. Now a prompt will open click on 'Apply' then the installation will start.


11. Now after installation, go to the path where you have installed MinGW and enter the bin folder in MinGW. Copy this path and paste it in the Path of Environmental Variable of your System. In my case path is 'C:\MinGW\bin'.
12. Now Relaunch Eclipse and then create a new project by clicking on 'create a new C or C++ project'. On Clicking it, the prompt will be opened. In that prompt select 'All - C++ Managed Build'. Now give a project name and under project type select 'Executable Hello world C++ project' and in Toolchain select 'MinGW GCC' this time instead of 'Cross GCC'. Then click next, next….. and at last finish.


13. CONGRATULATIONS ðŸŽŠðŸŽ‰ Eclipse is ready to use for C/C++ programming. A demo hello world program is created, now try to run it. To run a project. Click on Project on the top bar under it click on 'build project'. Now click Run on top bar and select Run. A prompt will pop up in that prompt then select Local C/C++ Application.

This is the whole process of installing and running the C/C++ Project in Eclipse.


References


Eclipse for CPP - https://www.softwaretestinghelp.com/eclipse-for-cpp/


Setup Eclipse for C/C++ Development - https://www.tutorialspoint.com/How-do-I-set-up-C-Cplusplus-on-Eclipse-in-Windows


Important Links


Download MinGW - https://sourceforge.net/projects/mingw/


Download Eclipse C/C++ Developer - https://www.eclipse.org/downloads/packages/release/kepler/sr2/eclipse-ide-cc-developers


Download JDK - https://www.oracle.com/in/java/technologies/javase-downloads.html


Download Eclipse - https://www.eclipse.org/downloads/

Chirag Goel

I am a developer, likes to work on different future technologies.

Post a Comment (0)
Previous Post Next Post