CSCI 1200 Data Structures
Spring 2016

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
  Homework Submission
  HW Grading Criteria

Collaboration Policy &
Academic Integrity

C++ Development
  Code Editors & IDEs
  OS Choices
  Installing Cygwin
  Memory Debugging
    Valgrind
    Dr. Memory

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

C++ Development Environment Options for your Operating System

Depending on the native operating system for your computer, you have several different options for C++ development with GNU g++ or LLVM clang++. More information on each choice is below.

Windows 7 & earlier

  • g++ with Cygwin
  • g++ or clang++ with Ubuntu Wubi (dual-boot)
  • g++ or clang++ with Ubuntu/other GNU/Linux in VirtualBox

Windows 8/8.1/10

  • g++ with Cygwin
  • g++ or clang++ with Ubuntu/other GNU/Linux in VirtualBox

Mac

  • clang++ in the Terminal or XCode IDE
  • g++ or clang++ with Ubuntu/other GNU/Linux in VirtualBox

GNU/Linux

  • g++ or clang++

NOTE: It is possible to run a true dual-boot on Windows or Mac by partitioning your hard drive and installing a GNU/Linux distribution there, but it requires a more complicated setup. Only do this if you really know what you're doing. Instructions exist online for how to do this, but it is possible to brick your machine this way and we won't necessarily be able to help you with any issues you encounter, though we will try.

 

Cygwin -- a UNIX environment for the Windows Operating System

If you are using the RCS default installation of the Windows operating system, you should already have Cygwin (although probably not all of the packages we need for this course). You can do all of your work for this class using Cygwin, g++, and a text editor such as Sublime (in other words, you don't need to use Visual Studio). Follow these steps to install Cygwin from scratch or add additional packages to an existing Cygwin installation:

MinGW (Minimalist GNU for Windows) is a lighter weight alternative to Cygwin:

 

MacOSX XCode

If you're using a Mac, you'll need to install XCode, which is a free download from the Apple App store. XCode provides both a C++ compiler (technically the LLVM clang++ compiler) and an integrated development environment (IDE) similar to Microsoft's Visual Studio.

Make sure to install XCode's "Command Line Tools" so that you can run the compiler from the Terminal command line. NOTE: Even if you plan to use the XCode IDE for the bulk of your development & testing, in lab & office hours we will usually ask you to demo your program from the Terminal command line.

There are many references online to walk you through installation (different versions of MacOSX might have slightly different procedures). Here's one:

 

Ubuntu Wubi

Ubuntu Wubi is a special installer that allows dual-booting Windows and Ubuntu without having to do disk partitioning or other complicated setup. Ubuntu is installed on your disk and you can remove it via the Windows Control Panel (where you uninstall normal applications) at any time. Install and uninstall instructions are here:

 

Ubuntu in VirtualBox

Here are some install instructions on installing Ubuntu in VirtualBox. If you want a different operating system, you can generally use the same instructions and just substitute the OS image you have for the Ubuntu one referenced in the instructions.

 

g++ or clang++ on Ubuntu:

Installing g++ or clang++ on Ubuntu (and many other GNU/Linux variants) is as simple as running one or both of the following commands in a terminal:

    sudo apt-get install g++ 
    sudo apt-get install clang++ 
 

Quick Test of Compilation

  1. To check that you're good to go, download this simple program and save it into your data structures directory:

    temperature.cpp
  2. Open a terminal and change directory to navigate to your data structures directory:

        cd INSERT_DATA_STRUCTURES_DIRECTORY_NAME
    
  3. Confirm you're in the right location by listing the directory contents typing:

        ls
    

    You should see the file temperature.cpp and maybe some other stuff.

  4. Compile the temperature program by typing:

      g++ -Wall temperature.cpp -o temperature.out
    

    (Alternatively, use clang++ instead of g++.) This should creates an executable named temperature.out. Type ls again to confirm the executable appeared!

  5. Now run that executable:

      ./temperature.out
    

    And you should be able to interact with this program at the keyboard.

 

Quick Test of Memory Debugger Installation & Usage

  1. Download and save this short (intentionally buggy) program:

    memory_debugger_test.cpp
  2. Follow the instructions for your system to compile this program for Memory Debugging. You'll need to add a few additional compiler flags, and you may need to use a different compiler.

  3. Now run the program under the memory debugger and locate the report generated by the memory debugger. (It may be printed directly to the terminal and/or saved to a file.)

    The report contains lots of data which can be intimidating the first time you see it. This tiny program has 4 different errors! We'll discuss the code, and the errors, and how to understand this report a few weeks into the term.