Setting Up Your Personal Development Environment (Eclipse)
Steven Zeil
1 Overview
This page walks you through the essential steps of setting up an IDE and a set of compilers on your own PC.
2 Preparation
An IDE (Integrated Development Environment) is a program that provides support for coding, testing, and debugging, and possibly other software development activities.
This should not be confused with a compiler, a program that translates programming source code into an executable form. An IDE serves as a convenient interface to a compiler, but also provides access to an editor, a debugger, and other tools as well.
- Some IDEs are designed to work with a specific compiler.
- Some can work with different compilers.
Similarly,
- Some IDEs are designed to work with a single programming language,
- but may work with differnet compilers for that language.
- Some can work with a variety of different programming languages.
Before setting up a development environment on your own PC, you need to consider
- What programming language(s) do you want to support?
- Which is more important to you, ease of installation or the ability of the IDE to grow with you as your programming skills increase?
The major programming languages in use in our Dept are C++ and Java. I’m going to assume that you want support for one or both of these.
The IDEs I recommend to most students are
-
Code::Blocks: This is familiar to many students because of its use in CS 150, 250, and 333.
- It works with C++ only.
- Installation is easy.
- But if you take the easiest route to installation, you will not be able to easily update your compiler.
-
Eclipse: This is a professional quality IDE that you can grow into. Despite that, it can serve novice programmers well, partly because it “knows” the programming language and can often offer you tips on how to fix common probleams and perform common tasks.
- Although it has a definite Java bias, it can be used with C++ (and quite a few other languages) as well.
- Installation is a bit tricker, mainly because you need to install a compiler separately.
Both Code::Blocks and Eclipse are free. Both can be used on Windows, Linux, and OS/X machines.
3 Installing Code::Blocks
3.1 Install Your C++ Compiler
As a general rule, you will need to install
- the compiler itself,
g++
- the
gdb
debugger (although Code::Blocks provides a nice interface for debugging, it’s still going to be running gdb behind the scenes.)
3.1.1 Linux
Get the latest available g++ compiler suite according to the usual procedure for installing packages on your system. This should be easy.
3.1.2 Mac
g++ is no longer available as an official Apple distribution. However, you can obtain the clang
C++ compiler, a worthy “competitor” to g++ that has a very loyal following, in a package called “Command Line Tools for XCode” available from Apple’s developer Site.
3.1.3 Windows
You have three main options here.
-
Skip this step. Code::Blocks for Windows comes in two different distribution packages: One includes a copy of the
MinGW
compiler in the package. The other does not.The advantage of using the package with the built-in compiler is ease of installation. The main disadvantage is that you will then need to update or re-install the entire Code::Blocks package to update your compiler.
-
The CygWin package provides a Posix layer in Windows, allowing much Unix software to be compiled and run without modification. When you install CygWin, you get a good command shell (
bash
). The g++ compiler can also be selected from the CygWin setup utility.A disadvantage of CygWin is that the compiler produces code that relies on the Posix layer, which in turn is provided by a CygWin DLL. Binary executables produced by the CygWin port of g++ can only be run on other machines that have a copy of that DLL.
-
MinGW, a “spin-off” project from CygWin, provides an alternate port of the g++ compiler that works without a special DLL. You may have used this already, as this is the g++ typically shipped with Code::Blocks and other basic Windows IDEs.
If you choose to install either the CygWin or MinGW compilers, go to their respective web pages and follow the installation instructions there.
- I recommend accepting their “default” location for the installation, as this will help Code::Blocks find the installed compiler.
3.2 Install Code::Blocks
Go to the Code::Blocks site and follow the instructions to download and install.
- If you are installing on a Windows PC and opted to skip the previous “Install Your C++ Compiler” step, then choose the
codeblocks-
…mingw-setup.exe
to get the version that includes the MinGW C++ compiler.If you are installing on a Windows PC where you have just installed a C++ compiler, get the
setup.exe
that does not include “mingw” in its name.
Run the downloaded program to install it.
4 Installing Eclipse
4.1 Install Your Compilers
4.1.1 Java
Java is distributted as a JRE (Java Runtime Environment) package for people who want to run Java programs but not write them, and as a JDK (Java Development Kit) package for those who want to write and compile Java programs. (Confusingly, the JDK is sometimes referred to as an SE package.)
You need at least a JRE to run Eclipse. You need a JDK to program in Java. If you aren’t sure, I recommend getting the JDK. Get it from Oracle here and run to install.
4.2 Install Eclipse
4.3 Optional: Add C++ Support
You may already be somewhat familiar with the Eclipse IDE that we will use as a platform for the rest of this semester. If not, this will be your opportunity to learn how to use it.
You may do the following steps in either order:
-
Do the labs Java Projects in Eclipse, Refactoring Java Code in Eclipse, and Debugging Java with Eclipse from the CS382 website.
-
Return to CS252 and do the two Eclipse-oriented Try This exercises in Program Development under X and Debugging under X.
5 Setting Up Your Personal Development Environment
Although Eclipse is available on both the CS Windows and Linux machines, over the course of this semester you will be working with a number of updates and extensions for Eclipse and so will need an Eclipse installation of your own where you can install these.
5.1 Choosing your platform
You want to choose a platform on which you will be comfortable doing development work, and which you will be able to use during team meetings in Hangouts. You might eventualy prefer to have multiple development environments to take advantage of the what machines you have available at differnet times and at different places.
I expect most students will choose to do this on their own PCs. The operating system is not critical: you can do everything we need in this course on Windows, Linux, or OS/X.
-
Some students have had good success using a virtual machine platform such as VirtualBox or VMWare to run a Linux OS on their Windows or OS/X PC and then use that virtual Linux machine as their development platform.
-
If using your own PC is not a viable option (e.g., your own equipment is woefully underpowered or out of date), then you can set up your own copy of Eclipse within your own account area on the CS Dept. Linux servers or the CS Windows PCs or Virtual PC lab.
-
Note, many of the CS machines will already have Eclipse installed, but it may be an older version. More importantly, you will be installing plugins for various software tools as we progress through the semester, and the pre-installed Eclipse that you share with the rest of the CS Dept probably will not allow you to do that.
Therefore, even if you are using a CS Dept machine as your hardware platform, you still need to do your own installation of Eclipse to serve as your personal development environment.
-
5.2 Compilers
You will need to have a Java 7 or 8 compiler and a C++ compiler. If you have opted to work on our CS Dept Linux servers, these are already available.
If you are installing on your own machine, Java should be fairly easy to obtain and install. You want the Java 7/8 JDK.
C++ may be more of a challenge, depending on your platform. As a general rule, you will need to install
- the compiler itself,
g++
- the
gdb
debugger (although Eclipse provides a nice interface for debugging, it’s still going to be runninggdb
behind the scenes. - the
make
build manager
5.2.1 Linux
Get the latest available g++ compiler suite according to the usual procedure for installing packages on your system. This should be easy.
5.2.2 Mac
g++ is no longer available as an official Apple distribution. However, you can obtain the clang
C++ compiler, a worthy “competitor” to g++ that has a very loyal following, in a package called “Command Line Tools for XCode” available from Apple’s developer Site.
5.2.3 Windows
You have two main options here. The CygWin package provides a Posix layer in Windows, allowing much Unix software to be compiled and run without modification. When you install CygWin, you get a good command shell (bash
), which may make a lot of things easier later in the semester. The g++ compiler can also be selected from the CygWin setup utility.
A disadvantage of CygWin is that the compiler produces code that relies on the Posix layer, which in turn is provided by a CygWin DLL. Binary executables produced by the CygWin port of g++ can only be run on other machines that have a copy of that DLL.
MinGW, a “spin-off” project from CygWin, provides an alternate port of the g++ compiler that works without a special DLL. You may have used this already, as this is the g++ typically shipped with Code::Blocks and other basic Windows IDEs.
Eclipse should work well with either the CygWin or MinGW compilers.
- Whichever compiler you choose, add the
bin
directory containing theg++
and other compiler executables to your Windows PATH so that Eclipse can find and run them.
5.3 Checking Your Compilers
It’s a good idea to check your installation of the compiler suites by issuing the following commands from a shell/cmd window:
javac -version
g++ --version
gdb --version
make --version
5.4 Eclipse
Get Eclipse for your platform from the Eclipse Foundation. If you have chosen to work on a CS Dept. machine, you should still do this, but install somewhere in your own account area.
You will find that the download page offers a bewildering variety of alternate packages. Don’t worry too much about that. You can start with a basic Eclipse installation, then add extension modules to provide the particular features that you want.
-
Start by downloading and installing the standard Eclipse distribution (a.k.a., Eclipse IDE for Java Developers).
Use some of the Java code you worked with in the Preparation section to verify that you are able to compile, run, and debug Java code form your new installation.
-
From the Eclipse Help menu, select
Install new software...
. Search “All Available Sites” for “C++” (Note, the search is really slow. Be patient.) or scroll down to “Programming Languages”. You want the “C/C++ Development Tools” and the “C/C++ Library API Documentation…”. Follow the on-screen instructions to install these. -
Go through some of your old C++ projects from your earlier courses. Pick one that involves two or more .cpp files and at least one .h file. Prove that your installation works by compiling and running that code.
-
Compose a short
README.txt
file describing the platform that you chose to install on, what Java and C++ compiler versions you wound up working with, and indicate whether there were any parts of this assignment that were particularly difficult or tricky for you. -
In the Eclipse
Help
menu, select “Installation Details”, then go to the “Configuration” tab. Copy and paste the text of the configuration report from that tab onto the end of yourREADME.txt
file and save it.
6 What to Turn In
You will submit the README.txt
file and the .cproject
file from the C++ project that you created above.
- If you are working in a *nix environment, remember that file names starting with a ‘.’ are hidden from view by default.
- For the same reason, the
.cproject
files will not show up in the file listing displayed by the online submission system.
When you are ready to submit your assignment, go here.