Difference between revisions of "compile-time error"

From Lazarus wiki
Jump to navigationJump to search
m (→‎Own compile time error: Fixed English)
 
Line 9: Line 9:
 
== Own compile time error ==
 
== Own compile time error ==
 
The [[Compiler directive|compiler directive]] <syntaxhighlight lang="pascal" inline>
 
The [[Compiler directive|compiler directive]] <syntaxhighlight lang="pascal" inline>
{$Fatal Error Message text} </syntaxhighlight> can be done
+
{$Fatal Error Message text} </syntaxhighlight> can create your own compile time error:
own compile time error
 
  
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
Line 24: Line 23:
 
   // because the compilation stopped in error
 
   // because the compilation stopped in error
 
end.
 
end.
</syntaxhighlight>
+
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
 
* [[runtime error|run-time error]]
 
* [[runtime error|run-time error]]

Latest revision as of 05:47, 17 September 2020

English (en) suomi (fi)

Compile-time error, which means the program did not compile. The compiler found and reported an error during compile time.

Fairly common compile time errors

  • Missed semicolons - A fairly common coding error is the omission of the required semicolons. Usually every Pascal statement ends with a semicolon

Own compile time error

The compiler directive {$Fatal Error Message text} can create your own compile time error:

begin
  // some code ..

  // To keep the compilation going
  // you need to change the code at this point

  {$Fatal  Error Message text}

  // .. here is the code that is not compiled
  // because the compilation stopped in error
end.

See also