Homework 1, G++ Flags and Makefile.

Short Description:

Learn about compiler flags and how to use them.

This assignment is worth 10 points.

Goals

When you finish this homework, you should have:

Warning

The purpose of this exercise is to investigate some poor programming practices and the compiler flags that alert you to their presence. As such, this code is NOT necessarily a good example of how to write code. That is why the compiler will produce warnings about this code.

If you see examples of code that you are unfamiliar with, please read them over carefully and identify how they violate the standard practices you have been taught. All code presented is syntactically correct, however it not all the code included contains good programming practices. If you have any questions about the code, please contact your instructor.

Please note, the g++ compiler changes over time. This means that warning flags change, produce different errors, or can be completely removed. This exercise has been designed to work with gcc version 8.3.1 (currently installed on cslab103). The compiler also supports different versions of the language. Both of these items will be discussed in the exercise.

This homework is designed to be interactive, with you reading all of the parts. Please do not just answer the questions.

Setup

  1. You should be logged into cslab103 to do this exercise.
  2. You should be working in a directory or folder for this exercise.
  3. You should have an editor and other tools required to change files on cslab103.
  4. You should have a word processor open to answer questions. In the end, you will need to submit a word document containing answers to questions and screen shots.
  5. As you go through each step, instructions will be provided at the end of the step on what you should do to receive credit for the step. Make sure that you label these in your document with the step number.
  6. In most terminal emulators, you can type clear to clear the screen for a clean screen shot.

Exercise

  1. What are compiler flags?
  2. Language Control Flags
  3. Warnings
  4. Warnings = errors
  5. Major warning flags
  6. Two other flags
  7. A Makefile

Some final notes

Required Files

A word document containing answers to questions and screen shots.

Submission

Submit the assignment to the D2L folder homework 1 by the due date.