Setting up Eclipse CDT on your Windows computer
lefttopCS-2301, System Programming for Non-majorsCS-2303, System Programming Concepts00CS-2301, System Programming for Non-majorsCS-2303, System Programming ConceptsSetting up Eclipse on your Windows ComputerHugh C. LauerIn CS-2301 and CS-2303, all programming assignments (except the first two Labs) will be carried out on Eclipse CDT. Eclipse is an open source Integrated Development Environment (IDE) that supports a wide variety of programming languages and software engineering tools. Eclipse CDT is set of tools and plugins for Eclipse to support programming in C or C++.Eclipse and Eclipse CDT are already installed on the public laboratory Windows systems throughout WPI. In addition, Eclipse can be run remotely (albeit slowly) on the CCC systems, with the user interface being displayed on the student’s workstation via an X11 connection. This document outlines how to install Eclipse CDT on your own desktop or laptop Windows computer. You will also need to install a GNU-compatible compiler and tool set. Eclipse itself is built on and runs in Java. If the appropriate Java environment is not already installed on your computer, you will also have to install that. Getting StartedOpen a browser to the URL and click the Download button. Select the latest version — CDT 8.1.2 for Eclipse Juno at the time of this writing. On the right side of the next page, select and download the version for your platform and operating system, being careful to select the 32-bit or 64-bit version as appropriate.Note: Although most of the assignments in these courses are 32-bit assignments, you should nevertheless select 64-bit if you have a 64-bit operating system. You should only install the 32-bit version on a 32-bit operating system. You can find out if your system is 32- or 64-bit by opening the Control Panel and selecting System. This will tell you a lot about your system, including, what kind of processors you have, how much RAM, and the “system type” (32-bit or 64-bit).The Control Panel can be opened in Windows?7 from the Start Menu. In Windows?8, point to the upper right corner of the screen to expose the “charms,” select the Search charm, and search for and open the Control Panel app.The installation file for Eclipse is about 130 megabytes, so you should download it via a fast network such as the WPI campus network. You may validate the download using the checksums published on the download page.The downloaded zip file comprises a single folder named eclipse. Expand this to a convenient location such as C:\Program Files (x86). The Eclipse application program is the file eclipse\eclipse.exe in the folder where you expanded it. To make it easier to start Eclipse, right-click on this file and select “Pin to taskbar” in either Windows 7 or Windows 8. This will cause a shortcut to appear in the taskbar at the bottom of the desktop. In Windows 7, you can also select “Pin to Start Menu” to make it appear in the list of programs in that menu.Java JDKNext, you have to ascertain whether Java is installed on your system. To do this, start the Eclipse application program. If it complains that javaw.exe is not in the search path, this means that Java is not installed at all on your computer (unlikely in most cases). If it complains that it could not load a particular Java dll, it means that Java Runtime Environment (JRE) is installed, but not the Java Development Kit (JDK). In either case, you need to download and install the appropriate version of Java JDK.To do so, browse to select the download button labeled “Java.” In the next window, accept the license agreement and select the version of the Java SE Development Kit appropriate for your system — i.e., Windows x86 for 32-bit systems, and Windows x64 for 64-bit systems. Download the installer file and run it to install Java JDK. You may have to reboot your system after installation.MinGWFinally, you need to install a GNU-compatible “toolchain,” including gcc, g++, make, and other tools needed to develop and debug C and C++ programs. There are two options — MinGW, the “Minimalist GNU for Windows,” and Cygwin, a Unix-like, POSIX-compliant environment and command-line interface for Microsoft Windows. For CS-2301 and CS-2303, MinGW is recommended (and it is installed on the public laboratory computers at WPI to support Eclipse). Later, if you need the advanced features of Cygwin, you can install it in addition to MinGW. Eclipse lets you select which toolchain to use on a project-by-project basis.Note: The MinGW available on this download page is a 32-bit version. It may run on either a 32-bit or 64-bit operating system, but it only generates 32-bit code for Intel processors.For developing 64-bit programs on Windows, you would need to use Cygwin.To install MinGW, start Eclipse. You will first be asked where you want to store your workspace. This folder will contain all of your Eclipse projects, so put it in a convenient place.Next, Eclipse CDT displays its Welcome screen, resembling the following:–Figure 1Select Help Contents from the Help menu to open a window to the Eclipse help system. In the left panel of that window, select C/C++ Development User Guide > Before you begin. In the page that appears, in the first bullet under the section Windows, right-click on the hyperlink labeled MinGW Downloads page. This takes you to a Source Forge page for MinGW. On that page, right-click on the link next to “Looking for the Latest version?” and select “Open in a new window.” If all goes well, you should get a browser dialog asking if you want to run or save the MinGW installation file. Save it to some directory, and then run it to install MinGW.MINGW_HOME environment variableBy default, MinGW installs itself in the directory C:\MinGW. If you install it somewhere else, you need to tell Eclipse where it is. You do this by setting an environment variable — i.e., a piece of text data with string name that is maintained by the operating system for the benefit of running programs. To set environment variables in Windows, open the System control of the Control Panel (as described above). In the left panel, select “Advanced System Settings.” This will bring up the System Properties dialog, shown in REF _Ref358626634 \h Figure 2 below.Figure 2In the “Advanced” tab, select “Environment Variables” to open the Environment Variable dialog shown in REF _Ref358626617 \h Figure 3.Figure 3The upper half shows the environment variables for you as an individual user. The lower half shows the environment variables for the system as a whole, applying to all users and all programs. In one or the other panel, create a new environment variable with the name MINGW_HOME. The value of this variable should be the pull pathname of the directory into which you installed MinGW. If this environment variable already exists, check to ensure that it has the correct value.Conclusion — WindowsCongratulations! You are now ready to use Eclipse and MinGW on your Windows system. When you create a new Project in Eclipse (you will learn to do this in Lab #4) you will be asked which toolchain to use for the project. Select MinGW from the options presented.Trying it outTest your Eclipse installation by repeating Laboratory Assignment #4 of this course. In that assignment, you were required to set up an Eclipse CDT workspace on a public laboratory computer and to use it to build and rebuild an existing application. It is important to remember that an Eclipse workspace is specific to a platform. The workspace contains pathnames and pointers to resources on a particular computer. Your own computer is likely to be configured quite differently from the public laboratory computers at WPI, so you need a separate workspace for it. To transfer programs from one workspace to another, use the Export command as described in Lab #4.Note: Unlike the public laboratory computers, your own computer will not have the firewall issue described in the Lab #4 write-up. Therefore, you may put your workspace in any convenient location without regard to being able to run the compiled programs.Following the instructions of Lab #4, you should create a new project, populate it with code, and build and run it. You should also get used to navigating, viewing, editing and exporting your code.A known problemA known problem (dating back to 2007 or earlier) with Eclipse and C/C++ programs is that the Eclipse console window “buffers” the console output so that it does not show in the console window until later, even if the program is asking for input. This happens both with MinGW and Cygwin. To see an example of this, use your copy of triangle.c that you wrote for Part 3 of Laboratory Assignment #1. Create a new C project named Triangle. In the project dialog box, select Empty Project under the Executable option, as shown in REF _Ref360543268 \h Figure 4 below. Be sure to select the MinGW toolchain and click Finish.Figure 4This is a bit different from Lab #4 because there is no existing makefile for the triangle.c program. By selecting Executable > Empty Project, you are implicitly asking Eclipse to create a makefile for you. Next, “populate” this project by selecting and dragging the icon of the triangle.c file over the Triangle entry in the Project Explorer of Eclipse. (The Project Explorer is the left-hand panel of the Eclipse window, and it lists all of the projects in your workspace.) Finally, build the project and try to run it.In the console tab, you will see an empty window of a running program, like this:–Figure 5It is waiting for input. It should have already typed Enter the X- and Y-coordinates of point A:-. However, due to this problem Eclipse/MinGW is holding onto that output line and not printing it.Type the input coordinates for point A, just as you did in Lab #1. Also type the input coordinates for points B and C. The triangle program now runs to completion. Suddenly, it prints all three prompts followed by the output based on your input answers.This is not a problem with your program. To convince yourself, run it in a Windows command prompt. In the command prompt, use the cd command to navigate to your workspace directory, and then to Triangle > Debug within the workspace. Run the program Triangle.exe in this command prompt. You will see that it behaves correctly and interactively, just as it did in the Linux shell in Lab #1.The workaround for this problem in Eclipse is to insert the following two lines of code near the beginning of the main() function of your program:–setvbuf(stdout, NULL, _IONBF, 0);setvbuf(stderr, NULL, _IONBF, 0);These function calls instruct the I/O system to set the buffer size to zero, thereby forcing Eclipse and MinGW to output every character. This is not a good long-term solution, but it will be satisfactory for this course. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- setting up a small business
- setting up a home business
- setting up my own business
- setting up a new business
- setting up amazon seller account
- setting up an investment portfolio
- games to download on your computer free
- turn off computer on keyboard windows 10
- trouble setting up email on windows 10
- setting up python on windows 10
- setting up file explorer in windows 10
- setting up outlook on microsoft edge