Compiling Instructions

A large number of libraries used in this class--especially Linux versions--are written in C/C++. You'll often have to build these libraries yourself in order to run them on your system.

We have set up a Linux machine and a Windows machines that run web servers visible within the rochester.edu domain. All members of the class have administrator rights on these machines, and you may use them for any class-related purpose. Please read the Custom Server Privilege Guidelines before using them.

Contents

Single File
Programs/Multiple Files



Single File


All compiling must be done from the Visual Studio command prompt, which initializes Visual Studio-specific enviornment variables. The console otherwise exhibits exactly the same functionality as a standard Windows command prompt. To launch, navigate to Start Menu > Visual Studio 2010 > Visual Studio Tools.

To compile a single file from the command line, you need to issue just one command--call the compiler executable with the source file and any special options. On Windows, use the cl.exe compiler; on Linux, use gcc .

Windows
Compiling a Native C++ Program on the Command Line

Linux
Chapter 7 of An Introduction to GCC by Brian J. Gough
gcc man page



Programs/Multiple Files


Make programs are special executables that ease compilation of large projects. A makefile specifies every target file that needs to be compiled or linked, and the code used to do so. Upon execution, the make program examines each target file and its listed prerequisites. If the target is older than its prerequisites, the associated block of code is run to update the target. For compiling source code, make primarily calls the compiler (using the above procedure behind-the-scenes), moves files, and deletes intermediaries.

Windows
The make executable of choice for Windows is nmake; it is included with Visual Studio. Again, you must use the Visual Studio Command Prompt (Start Menu > Visual Studio 2010 > Visual Studio Tools).
MSDN Documentation | Nmake Tutorial

Linux
The make executable for Linux is GNU make, which can be called from a terminal by typing make <filename>.
Make Manual Page | Make Tutorial