CSCI 1200 Data Structures
Spring 2015

Home
  Contact Information
  Announcements
  Discussion Forum (LMS)

Syllabus
  Learning Outcomes
  Prerequistites
  iClickers in Lecture
  Course Grades

Calendar
  Lecture notes
  Lab materials
  Homework
  Test reviews

Weekly Schedule
  Office Hours
  Lab Times

Getting Help
  Tutoring
  Advice from TAs
  Advice from Students

Homework
  Due Date and Time
  Late Day Policy
  Compilers
  Electronic Submission
  HW Grading Criteria

Collaboration Policy &
Academic Integrity

References
  Optional Textbooks
  Web Resources
  C++ Development
    Compilers
    Code Editors & IDEs
  Misc. C++ Programming
    Command Line Args
    File I/O
    string → int/float
  Memory Debugging
    Valgrind
    Dr. Memory

Downloading and Installing or Upgrading Cygwin

  1. 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.

  2. 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.

  3. 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 again.

  4. 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.

  5. 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 "1.2.3.4".

    • 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 select "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.)

  6. 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.

  7. Click finish and pat yourself on the back, you've finished a complete Cygwin install.

Helpful edits to the Cygwin .bashrc file

  1. 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.

  2. To quickly navigate to your Data Structures files, you can add a variable that points to that directory in your .bashrc file:

       DS=/cygdrive/c/Users/YOUR_USER_NAME/Documents/PATH_TO_YOUR_DATA_STRUCTURES_FILES
    

    Then at the Cygwin prompt, you can use that variable:
       cd $DS
    
  3. 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
    
  4. 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.