- Students often find compiler messages overwhelming and unhelpful.
- If we provide students with the vocabulary they need to understand these error messages, we can help students learn to use compiler messages to debug their code.
- The following vocabulary appears frequently in error messages:
- operand
- declaration
- identifier
- binary expression
- specific types (like double, int etc), as well as the word "type"
- segmentation fault
- expression
- token
- preprocessing directive
- Activity:
- Give students example code and error messages to see if they can decode what the error messages are trying to say.
- Ask students:
- What does this error message mean?
- What did the compiler think you were trying to express?
- Based upon this error, what inferences can we make about what the compiler is expecting?
- In Example 1 below we can infer that identifiers/variables don’t have spaces in them.
- Here are two example error messages you can use:
- Example 1:
- Example 2: