CISC220 F2021 Setup
All example code and template code for this course has been developed and tested on a Linux system. To do labs and programming projects, you should have access to one as well for coding, compiling, and debugging. Options:
- A very basic option for playing around, which is not enough for homeworks, is an online C++ shell. Try it!
- 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. Unfortunately the Spencer 010 machines will not boot from the USB port without an admin password, but a DVD should work.
- 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. Here is a free option:
- VirtualBox. I found these instructions helpful when setting up VirtualBox for Ubuntu. If you have VirtualBox with Ubuntu left over from CPEG 202, I recommend doing a fresh install -- several students had problems trying to reuse this installation. If you are having trouble with low screen resolution, try this fix
After OS setup
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.
- xemacs is my old-school text editor of choice. It has mouse-and-menu options like gedit, but also keyboard shortcuts to speed things up. apt-get install xemacs21 to get it, and untar this in your home directory to get one flavor of syntax highlighting. Here's a getting started guide
- Code::Blocks and Eclipse are cross-platform, full-featured IDEs for C++ and geany is an Ubuntu coding-oriented text editor with IDE features. 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.
- To invoke the terminal (aka command line) in Ubuntu, 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. 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.
- 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.
A final note
If you are devoted to Windows Visual Studio or MacOS XCode and you don't want to venture into Linux-land, that's ok. But as with the IDEs mentioned above, you will be on your own in making projects and importing the template code that I provide.