CISC220 F2023 Setup

From class_wiki
Jump to: navigation, search

All example code and template code for this course has been developed and tested on a Linux system. To do labs and programming projects, it MIGHT be helpful to have access to one as well for coding, compiling, and debugging.

Try this first

  • A very basic option for playing around, which is not enough for homeworks, is an online C++ shell.
  • Maybe the easiest option, which you should be familiar with from CISC210: SSH to an existing UD Linux machine such as go.cis.udel.edu. You should already have an account or it should be straightforward to request/renew one.

More advanced/time-consuming/scary options

  • Run Linux on your own Windows/MacOS laptop/desktop. I recommend Ubuntu desktop. If you don't have a Linux distribution already, there are 3 standard approaches:
    • Install Linux to a DVD or USB stick and run it "live" by booting your machine from it (details in Ubuntu install instructions). This may require fiddling with your BIOS boot order settings, but it offers the advantages of (a) not changing your hard drive at all, and (b) theoretically you can walk up to any machine and run Linux on it.
    • Add a boot-time Linux option (aka "dual-booting"). This is pretty easy and built into the Ubuntu installer (again, see Ubuntu install instructions). Usually I make a USB stick first to test that everything works on my machine (trackpad/mouse buttons, wifi, graphics drivers, and power button/lid closing are the most common issues with laptops), and then inside Ubuntu there is an option to install it to the hard drive permanently.
    • Create a virtual machine, which lets you run Linux from within Windows or MacOS without rebooting. Performance is generally slower than the above options, but for CISC 220 it should be entirely acceptable. Common options (which I believe are free):

After Ubuntu is installed, you need to make sure there's a C++ compiler and a text editor or integrated development environment (IDE) as well:

  • In Ubuntu, apt-get install g++ will install the compiler and related basic libraries
  • gedit is Ubuntu's built-in text editor and is what will open if you double-click a code file in the file explorer. It has syntax highlighting and should work just fine.
  • emacs is my old-school text editor of choice. It has mouse-and-menu options like gedit, but also keyboard shortcuts to speed things up. Here's a getting started guide
  • Code::Blocks and Eclipse are cross-platform, full-featured IDEs for C++. I will not explain how to install or use them beyond what is written below, but feel free to try them if just a bare-bones text editor doesn't do it for you.
    • Code::Blocks: Make a new C++ project of type "Console Application" and follow the wizard instructions to name it, choose a directory, etc. Once it's created, put the CISC220-supplied main.cpp and any .txt files into the project directory, overwriting the Code::Blocks-created main.cpp. To compile, choose "Build and run" from the "Build" menu. If the program expects command-line input (like the name of a file to read), go to the Project / Set Programs' Arguments menu and type the filename or whatever into the Program Arguments text box.
    • Visual Studio instructions for building a C++ console app
    • Prof. Yarrington's instructions for C++ on Eclipse

Further links for help in Unix

  • If you installed Ubuntu and you have a GUI-like desktop environment, to invoke the terminal (aka command line), click on the Ubuntu icon in the upper-left of the start bar to bring up the "dashboard". Type "terminal" in the search box and an icon for the terminal app will appear. Click this, or you can drag it to the start bar so it's always there. If you are SSH'ing to a Linux machine, you will be in the terminal by default.
  • Once you are in the terminal, here is a tutorial on commands, but the key ones are:
    • ls: List directory contents. This tells you what files and subdirectories are in the current directory.
    • cd: Change directory. This is how you move around between directories/folders. cd all by itself takes you back to your home directory, cd <name of subdirectory> takes you down to a subdirectory of the one you're in, and cd .. takes you up to the next higher-level directory.
  • tar/untar
    • General instructions here. You can do both operations from the file explorer: right-click on a tar file and choose "Extract Here", or right-click on a directory and choose "Compress".
    • To untar a file named foo.tar from the command line: tar -xvf foo.tar while you are in the same directory as foo.tar
    • To tar a directory named foo into a a tarfile named foo.tar: tar -cvf foo.tar foo while you are at the directory level ABOVE foo.