How to set up C/C++ development environment in Eclipse

If you are a C/C++ developer looking for C/C++ IDE to work with, you can consider Eclipse-based IDE. Eclipse boasts of an extensible plug-in system for customizing IDE to support various programming languages including Java, C/C++, etc. Eclipse CDT is one such plugin which converts Eclipse into a fully functional IDE for C/C++ developers.

Eclipse CDT has the following features to help developing C/C++ programs.

  • Standard make build, as well as managed build with various toolchains.
  • Source navigation tools such as type hierarchy, call graph and hyperlink navigation.
  • Code editor with syntax highlighting.
  • Source code refactoring and code generation.
  • Visual debugging tools.

In this tutorial, I will describe how to set up C/C++ development in Eclipse by installing Eclipse CDT.

I assume that you already have a working installation of Eclipse ready on your system.

First launch Eclipse, and go to "Help"->"Install New Software" menu.

Click on "Add" button to add a new repository. Fill in repository name, and specify the URL location of the repository as follows.

  • Eclipse 4.3 (Kepler): http://download.eclipse.org/tools/cdt/releases/kepler
  • Eclipse 4.2 (Juno): http://download.eclipse.org/tools/cdt/releases/juno
  • Eclipse 3.7 (Indigo): http://download.eclipse.org/tools/cdt/releases/indigo
  • Eclipse 3.6 (Helios): http://download.eclipse.org/tools/cdt/releases/helios
  • Eclipse 3.5 (Galileo): http://download.eclipse.org/tools/cdt/releases/galileo

Enable checkbox for "CDT Main Features" and "CDT Optional Features", and click on "Next" button.

Review the items to be installed. Finally, go ahead and install C/C++ development tools on Eclipse.

After installation, restart Eclipse.

To verify that CDT has been installed successfully, go to "Help"->"About Eclipse" menu, and check if Eclipse CDT icon is listed there.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

10 thoughts on “How to set up C/C++ development environment in Eclipse

  1. Every 18 months or so I try to get used to Eclipse for C++. I'm just too much of an old dinosaur. I like emacs and Makefiles. But here I go, downloading CDT again ;-)

  2. I'm surprised QtCreator doesn't get more love. It's blazing fast compared to Eclipse CDT and is optimized for C/C++ development instead of being a generic (but primarily Java) IDE with C/C++ support bolted on.

    • A good point. The problem I think is that it's branded with "Qt" and, while not an intrinsic problem, it does imply that it's for writing GUIs, so it doesn't show up on people's radar.

      • That's true, the Qt branding may hurt it somewhat. In my case, I don't write any GUI code and use QtCreator all the time just because it has a blazing fast code indexer that just works without any hoop jumping.

        I think Ubuntu is calling it "Ubuntu SDK" or something in their newest releases. It's the same code as QtCreator, but just with a different name. I wonder if that will make a difference?

    • QtCreator supports Makefiles, and CMake projects (it also provides own project format -- qmake), work robustly, because it's written in C++. Eclipse or Netbeans will push users to use their own project building systems (based on XML), not a good option for C programmers. Their only use case is Java-coding (with Ant or Maven build systems).

      • I can't speak for NetBeans, but Eclipse/CDT can easily be made to work with Makefiles. Nevertheless, I have put QtCreator on my list of things to try.

        • Makefile support is a good thing, but it's sometimes painful for usage under MS windows. CMake is commonly used by companies for building C and C++ cross-platform projects. It can generate MSVC projects. People who don't like its syntax may take a look at Premake with Lua scripting. The customers usually require that the code be able to be successfully compiled via MSVC (support of MinGW is a good option too) for Windows and GCC for Linux or MacOS. That's why I disadvantage IDE's with solely Makefile + own XML project support.
          Resume: imho programmers should stick to some popular cross-platform code building systems and IDE's that support them but not vice versa.?

  3. I remember sometime in the 1980s I bought a 6502 monitor/debugger on ROM. In the manual, it said "a debugger is an invaluable tool, but it's no substitute for thinking and reasoning about your code - don't come to rely too heavily on the debugger because one day you'll be in a situation where it is unavailable to you for whatever reason".

    It took decades for me to fully appreciate that advice. Notice that pretty much every Java programmer on the planet uses an IDE of one kind or another. And notice also that in order to understand any large-ish Java codebase, you need an IDE; it's no longer an optional luxury. The IDE started out like the cool drug-dealer at the school gates offering free samples, but in the long run, dependency has its cost, human and financial.

    One could argue that programming, at its core, is the process of keeping complexity below some tolerable threshold: well, my theory is that in languages like Java where tooling-dependency is high, that "tolerable threshold of complexity" is naturally much higher than in languages like C, where tooling-dependency is less widespread.

    • I SWEAR I remember reading that back in the day.

      I'd contend that keeping away from IDEs has improved my programming because I am FORCED to structure my code base such that it's easy to manage, rather than have some toolchain do it for me. It's one of the reasons I tend to find these VM languages so damn offensive. Not because of anything wrong with the languages (a different conversation entirely) but because the toolchains hide complexity out of necessity, leading to lazy coding habits, rinse, repeat.

      But all that said, I really like the toys that these things have in them nowadays. Alas.

      • Oh don't get me wrong, I love Java; alongside C it's probably the language I'm most comfortable with. I don't even think IDEs are a bad thing, per se (I use Eclipse for Java but for C, like you I rely on emacs & make), but I recognise that the seemingly-innocent decision about whether or not to use an IDE actually has profound consequences, both for me, my projects and the community and ecosystem of the language as a whole.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *