When creating, editing, or sometimes just using Snippets, you may receive error messages in the Output Window.  Resolving those errors can be as simple as What, Where, Why.

Looking at the error messages below, whilst most of it seems to make no sense at all, you can in fact ignore all of the “programmer speak” as there are really just two key pieces of information;

  1. The snippet name,
  2. The line number in the TEMP_MTF file.
  INS_R_ROAD.mtfsnippet.temp_mtf:2: unterminated string or character constant
  INS_R_ROAD.mtfsnippet.temp_mtf:2: possible real start of unterminated constant
"INS_R_ROAD.mtfsnippet.temp_mtf", line 2.29: error:parse error
ERROR: line 2 column 29 - L
"INS_R_ROAD.mtfsnippet.temp_mtf", line 3.1: error:parse error
  INS_R_ROAD.mtfsnippet.temp_mtf:2: unterminated string or character constant
  INS_R_ROAD.mtfsnippet.temp_mtf:2: possible real start of unterminated constant
"INS_R_ROAD.mtfsnippet.temp_mtf", line 2.29: error:parse error
ERROR: line 2 column 29 - L
"INS_R_ROAD.mtfsnippet.temp_mtf", line 3.1: error:parse error

In the errors above, from the first message;

INS_R_ROAD.mtfsnippet.temp_mtf:2: unterminated string or character constant

We see that the problem is with the snippet “INS_R_ROAD.mtfsnippet”, and there is a single error;

ERROR: line 2 column 29 - L

Open the “INS_R_ROAD.mtfsnippet.temp_mtf” file in a text editor, and go to Line 2;

If we take a closer look at Line 2, we can start to break it down and look for anything that may be causing the error.

left_side_modifier = {
insert "KLL" ... "rd bitumen" $(FRED) unknown -3.0 named_position ...  ... extra_end // 40
}

What:  On Line 2 is an unresolved parameter $(FRED).  We now know what is causing the error.

Where:  At the end of Line 2 there is a comment “//  40“.  This corresponds with the offending line number in the Snippet.  We now know where the error is occurring.

Why:  Edit the Snippet and go to Line 40, and you can see the parameter $(FRED).  Whilst the error is occurring at Line 40, this may not always be the cause of the error.  For some errors it is necessary to work backwards through the Snippet to find why $(FRED) is causing an error.

In the Snippet below, we can see that the parameter “FRED” is not defined anywhere.  Now we know the why, we can fix the error.