I Discovered Eclipse and CDT

I discovered Eclipse, a multi-platform, multi-language IDE. I got interested when I read a news article somewhere that Eclipse is not just for Java anymore, and I wanted to try it out since. Recently I had a couple of ideas to play with but I was not looking forward to doing it the hard way, with a text editor and command line tools. Since I decided to adopt GCC, I was interested to see if GCC could be integrated into some generic IDE, and Eclipse seemed like a good place to start looking, and I was blown away by it. I wish I have tried it sooner!

Here I want to share what I’ve found so far.

Aplied to C/C++ development, Eclipse offers an Integrated Development Environments with the following features:

  • Syntax-aware code editor
  • Integration with gnu make, gcc/g++ and gdb debugger
  • Managed make files
  • Many gcc compiler and linker options integrated into the graphical interface
  • Integration with CVS
  • Project management

This is not a complete list by any means, but just being able to do those things makes it worth using. It’s not proprietary, so you won’t be obsoleted out of your familiar environment by the vendor, like Borland and Microsoft did to developers on multiple occasions, and it’s written in Java, so it runs on a variety of platforms out there which will make my experience with it re-usable when I switch to Linux. It needs a lot of memory though: Task Manager reports Memory Usage of 100MB and up. It runs on my little Fujitsu 1120 with a 800 MHz Transmeta processor and 240MB of memory, but my desktop with 512MB of RAM handles it much better.

To start using it, you need to download and install two components: Eclipse SDK and C/C++ development tools (CDT). Installation.. well, on Windows I did not have to install anything – I just extracted the SDK into c:\eclipse and then extracted CDT over it into the same directory, and it worked.

Neither Eclipse nor CDT include the compiler itself, which you need to download and install separately. I was able to get MinGW to work relatively easily, but the installation was a bit involved. If you look at MinGW website, it is difficult to figure out what you actually need to start using it, and the baffling array of download choices scares newcomers away. It seems that many community-based software development efforts have this sort of “initiation rite” where all newcomers must learn the ropes the hard way, by trial and error, hours of googling for the right answers and reading countless manuals before they succeed in using the software in question.

But I was prepared to deal with it, and now you can have a gist of it without having to do it the hard way. First, you need to download latest releases of the following packages: binutils, gcc-core, gcc-g++, gdb, MSYS, w32api and mingw-runtime.

Begin with installing MSYS. It wants to be installed into C:\MSYS\1.0 directory; you should let it do so. Before it finishes, it will open a Command Prompt window and ask whether you want to “normalize” – say no. Next, install gdb – it will be installed into c:\mingw which is fine as well. Other packages are simple archives containing a folder structure that must be extracted into c:\mingw. Some archive programs will not extract folder structure over an existing one – they will remove the existing folders fist. 7-zip works fine for me. During extraction, there are several file conflicts, but I discovered that you can just allow 7-zip to overwrite existing files, and it does not seem to affect the functionality as far as the tools that we need are concerned.

Next, add c:\msys\1.0\bin and c:\mingw\bin to the front of your system PATH environment variable. You can also do that in Eclipse/CDT. By the way, I found that it shows system path as prepended with c:\cygwin\bin even though it is not so in your Environment Variables, so watch out if you have CygWin installed on your system as well because its tools will have a priority over any others with the same names.

After you’ve updated the PATH variable, you can test the installation. Simply open command prompt and type several commands, all of which should return something other than standard Windows command prompt message “‘xxx’ is not recognized as an internal or external command, operable program or batch file.” The commands you should test are: gcc, g++, ld, rm, make, windres (press Ctrl-C to return to command prompt) and gdb (type quit to return to command prompt.)

Now you’re ready to type c:\eclipse\eclipse and start programming! Put a shortcut to c:\eclipse\eclipse.exe on the desktop or in the Start menu for convenience.

Leave a Reply