Getting Set Up
Contents
Overview
This document will help you install a text editor to edit C++ programs, as well as a compiler. By the end, you should be all set up.
Text editor
The editor we will use on the Macs in the lab is Sublime Text 3. This is available for OSX as well as Windows. If you have OSX < 10.7, you probably will need to install Sublime Text 2. Sublime text, however, is not free. You can use the fully functional trial as long as you want, but it costs $75 to register.
There are many alternative. jEdit is a completely free, cross-platform editor. You may also wish to use a built in editor: Windows has Notepad, and Mac has TextEdit. In both cases, be sure that you are editing in the text format, not the rich text format.
Compiler
Choose your platform and install. You can test by opening Terminal (Mac) / PowerShell (Windows) and entering g++
. If you get a warning that no files were provided, then you're all set! Otherwise, if you get an error about the command not being found, something went wrong...
Mac
If you already have XCode installed, you are done with this step. If not...
OSX 10.9 Mavericks
Go to Apple's developer download page and register if you haven't already—registration is free. Search for command line tools. Pick the most recent release for 10.9 Mavericks and install.
OSX 10.8 Mountain Lion or earlier
This project is for you as it will get you only the parts of XCode that you need for this. Download and install the package that matches your version of OSX (10.6 == "Snow Leopard", 10.7 == "Lion", 10.8 == "Mountain Lion").
(Back to top)Windows
The MinGW platform provides that and the other associated tools you need. Start by downloading the installer here.
Once that's downloaded, go ahead and install it. The first window in the installation process should look like this:
Select "Install". The next screen will ask you for some options. Just stick with the defaults and click "Continue".
That will cause MinGW to be downloaded. You should see a window like below; once it's finished, select "Continue".
The next window that displays is the MinGW Installation Manager. You'll need to select a bunch of packages and mark them to be installed. Start by right clicking on the "mingw32-base" package and select "Mark for Installation", as shown in the screen shot below. That will make the little box to the left turn green with a little arrow on it.
There's a few more packages you need to mark -- be sure that you right-click on the following four packages and select "Mark for Installation". This will cause many additional packages to be marked automatically (don't worry, that's suppose to happen):
- Under "Basic Setup":
- mingw32-base
- mingw32-gcc-g++
- mysys-base
- Under "All Packages" (to get to this, click on "All Packages" in the far-left pane, then scroll down in the pane on the right until you see the package name):
- mingw32-libpdcurses
Once you've marked all four, you'll need to apply the changes. Do this by clicking the "Installation" menu and selecting "Apply Changes", like this:
That will cause a confirmation window to appear; click "Apply":
That downloads and installs all the packages marked for installation. Once it's finished, the installation window will stay open; just click "Close":
And finally, you can close out of the MinGW Installation Manager. The next think you'll have to do is set your path (see the section below).
(Back to top)Setting your path
For Windows users, to change the PATH environment variable settings...
- Right click on "My Computer" and select properties:
- Click on "Advanced Settings" and from the "Advanced" tab click the
Environment Variables
button:
- In that popup window you want to edit the PATH system variable:
- At the beginning of the value, add value from the tutorial. Specifically:
C:\MinGW\bin;C:\MinGW\msys\1.0\bin;
Great! Your path should be all set!!
(Back to top)