CSCI 1200 Data Structures
Spring 2018

Home
  Contact Information
  Announcements
   Forums (Piazza)

Syllabus
  Learning Outcomes
  Prerequisites
  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
  Submitty
  HW Grading Criteria

Collaboration Policy &
Academic Integrity

C++ Development
  Code Editors & IDEs
  OS Choices
  Install WSL
  Install Cygwin
  Memory Debugging
    Dr. Memory
    Valgrind
    ASAN
  Test Your Installation

References
  Optional Textbooks
  Web Resources
  Misc. C++ Programming
    Command Line Args
    File I/O
    string → int/float

Using Windows Subsystem for Linux (WSL)

NOTE: These instructions are new this term, and will be updated as needed.

     

  1. You'll need Windows 10, build number 15042 or greater to use WSL
    You can check your version by going to Settings -> System -> About.

     

  2. Enable Developer Mode:
    Start Menu → Settings → Updates & Security → For developers → and then check "Developer Mode".

     

  3. Turn on "Windows Subsystem for Linux":
    Start Menu → Settings → Search for "Turn Windows features on or off".
    From that menu, check the box next to "Windows Subsystem for Linux (Beta)"

     

  4. You'll probably need to reboot your computer.

     

  5. Launch bash:
    Hit windows key, search for "bash", and select "bash" (before installation is complete) or "Bash on Ubuntu on Windows" (after installation is complete).
    This should launch a bash.exe terminal.

    The first time you open the bash WSL terminal, it will ask to install Ubuntu on Windows. Press 'y' and enter to continue. Then choose a username & password.

     

  6. Install Ubuntu updates:
    (Type these commands into your bash terminal.)

        sudo apt-get update
        sudo apt-get dist-upgrade
    

     

  7. Install the necessary packages for this course:

        sudo apt-get install g++ clang gdb zip valgrind
        sudo apt-get install gcc-multilib g++-multilib
    

    And press 'y' to continue.

     

  8. Ensure that we can properly terminate a runaway WSL program:
    (In case Ctrl-c does not work for you.)

    NOTE: Do not attempt to edit WSL system files from Windows. The permissions and filesystem will get messed up and you'll need to reinstall everything to recover.

    From the WSL bash terminal (using vi to edit the file):

        vi ~/.bashrc
    

    Press 'G' to go to the end of file. Press 'A' to append to the end of the line.
    Press enter twice. Then type:

       stty intr \
    

    Then Ctrl-v, Ctrl-k. And the last line of the file should now look like this:

       stty intr \^K
    

    Then press escape, then press ':wq' and enter to save the file.
    To have the new command take effect, run:

       source ~/.bashrc
    

    Now if you want to quit a running program, press Ctrl-k.
    (Ctrl-c might work for you too.)

     

  9. Install Dr. Memory for WSL:
    Follow these instructions...

     

  10. Install a good code editor on Windows.
    If you don't already have a favorite, we recomend Sublime Text.

     

  11. Create a new directory for your work for this course on Windows.
    Save the sample files to this directory.

    NOTE: It's easier if you avoid spaces or other non-alphanumeric characters (underscore is fine) in your file & directory names.

     

  12. In your WSL bash terminal, go to your directory for the course.
    Windows paths are available in WSL from the /mnt/ mount point.
    For example, if you saved the file here:
    C:\Users\myusername\Documents\DataStructures\temperature.cpp
        
        cd /mnt/c/Users/myusername/Documents/DataStructures/
    
        ls
    

    And you should see your file.

    NOTE: If you have spaces in your directory or file names, you'll need to escape them with a backslash. E.g., Data\ Structures.

    Now compile the file:

        clang++ -o temperature.out temperature.cpp
    

    And then run it:

        ./temperature.out
    

    Or to test it through the memory debugger:

        drmemory -- ./temperature.out
    

    Or:

        valgrind ./temperature.out
    

     

  13. To disable the tab-complete bell in WSL bash terminal (it quickly gets annoying):

    NOTE: Do not attempt to edit WSL system files from Windows. The permissions and filesystem will get messed up and you'll need to reinstall everything to recover.

    From the WSL bash terminal (using vi to edit the file):

        sudo vi /etc/inputrc
    

    Scroll down to the line:

        # set bell-style none
    

    press 'x' twice to uncomment that line:

        set bell-style none
    

    press ':wq' and enter to save the file.

    You'll need to close and restart your bash terminal for it to take effect.

     

  14. Now, Test Your Installation.

     

  15. If you have trouble with Valgrind on WSL, you may need to follow these instructions:

    http://www.albertgao.xyz/2016/09/28/how-to-use-valgrind-on-windows/