Discussion Forum (LMS)
iClickers in Lecture
Advice from TAs
Advice from Students
Collaboration Policy &
Due Date and Time
Late Day Policy
HW Grading Criteria
Code Editors & IDEs
Misc. C++ Programming
Command Line Args
string → int/float
Downloading and Installing or Upgrading Cygwin
Go to http://www.cygwin.com
and click the "Install or Update now!" link (in the middle of the
page, or the side, with the Cygwin icon above it) and download the
setup file to somewhere where you can find it. There are both 32 and
64 bit versions; make sure you remember which one you get because
you'll need to use the same setup file each time you go to install
more packages or you'll end up with 2 Cygwin installations.
Double click the setup file, click next, and then select the "Install
From Internet" box, then click next again (keep all the settings here
the same), then click next one more time.
Make sure to set the local package directory to C:\cygwin (or
C:\cygwin64 for the 64-bit version), then click next, and
then next again. Here pick a mirror, any mirror, and then click next
There's a ton of info on this next page of packages to choose and
such, just keep the "Curr" choice selected at the top.
You will need to install a number of extra packages for your work in this course:
First, type "zip" in the search box near the top of the
installation window. Open up the "Archive" section, then locate the
"zip" package. The description should be
"zip: Info-ZIP compression utility"
. Click on the word "Skip" on that line to indicate we want
to install zip rather than skipping it. A version number should
appear, like "18.104.22.168".
Next, type "g++" in the search box. Open up the "Devel"
section, and click on "Skip" for
"gcc-g++: GNU Compiler Connection
(C++)" until the version number appears.
Also, type "gdb" in the search box. Open up the "Devel" section, and
"gdb: The GNU Debugger" for installation.
Then, type "clang" in the search box. Click "Skip" for
"clang: C/C++/ObjC compiler frontend based on LLVM" until the
version number appears.
Finally, type "mingw" in the search box, open up the "Devel"
section, and install
"mingw-gcc-g++". (This is needed to run
the Dr. Memory memory debugger.)
Then go ahead and hit next. If a "Resolving Dependencies" window
shows, make sure the "Select required packages" box is checked, hit
next again and take a coffee break. Your computer is going to download
a plethora of packages, and then install them. It may tell you that
you have to reboot after the install, if it does, do so.
Click finish and pat yourself on the back, you've finished a
complete Cygwin install.
Helpful edits to the Cygwin .bashrc file
First, locate your .bashrc file for the current user.
This is probably c:\Cygwin\home\YOUR_USERNAME\.bashrc (or just
~/.bashrc from the Cygwin shell). Make a copy of this file and put it
somewhere safe before making the changes below, so you can undo in
case anything goes wrong.
Use Notepad++ or Sublime to edit the .bashrc file, and NOT Notepad or Wordpad.
If you see weird errors like "\r command not found", navigate to the directory
containing the .bashrc file and run the following line:
tr -d '\r' < .bashrc > .bashrc
and then restart Cygwin.
To quickly navigate to your Data Structures files, you can add
a variable that points to that directory in your .bashrc file:
Then at the Cygwin prompt, you can use that variable:
To make an alias for the MinGW compiler with the options necessary for Dr. Memory,
add this to your .bashrc file:
alias memg++='i686-pc-mingw32-g++.exe -static-libgcc -static-libstdc++ -ggdb'
Then at the Cygwin prompt, you can type:
memg++ -o foo.exe my_source_1.cpp my_source2.cpp
Finally, let's add Dr. Memory to your Cygwin path (which is different
from your Windows path that the Dr. Memory installer may have already
edited automatically). At the end of the .bashrc, add this line:
PATH=$PATH:/cygdrive/c/Program\ Files\ \(x86\)/Dr.\ Memory/bin
Now to run Dr. Memory from Cygwin, you can just type:
drmemory -brief -batch -- foo.exe arg1 arg2
Note: You'll need to close & reopen Cygwin to after editing
your .bashrc file.