CSCI 103 Summer 2018 Introduction to Programming

CSCI 103 Summer 2018: Introduction to Programming

Compiler Info

The compile command on the course VM is a novice-oriented compiler command.

It can be used in three ways.

What does compile do?

The compile command is a simple wrapper for clang++. Its main purpose in life is to add a long list of novice-friendly compiler flags. The flags turn certain warnings on or off and enable debugging.

Specifically, the compile command adds these options:

-g -Wall -Wvla -Wshadow -Wunreachable-code -Wconversion
-Wno-write-strings -Wno-sign-compare -Wno-sign-conversion

For example,

compile prog -o prog.cpp

is just a shorthand for

clang++ prog -o prog.cpp -g -Wall -Wvla ...


If you're not using the course VM, then you can install the compile command as follows:

sudo bash -c 'mv compile /bin/compile; chmod a+x /bin/compile'

You may also need to install clang++. On the version of Ubuntu we use, this is done via:

sudo apt-get install clang