Compilation error

From Wikipedia, the free encyclopedia
  (Redirected from Compilation state)
Jump to: navigation, search

Compilation error refers to a state when a compiler fails to compile a piece of computer program source code, either due to errors in the code, or, more unusually, due to errors in the compiler itself. A compilation error message often helps programmers debugging the source code for possible errors.


Common C++ compilation errors[edit]

  • Undeclared identifier, e.g.:

doy.cpp: In function `int main()': doy.cpp:25: `DayOfYear' undeclared (first use this function)[1]

This means that the variable "DayOfYear" is trying to be used before being declared.

  • Common function undeclared, e.g.:

xyz.cpp: In function `int main()': xyz.cpp:6: `cout' undeclared (first use this function)[1]

This means that the programmer most likely forgot to include iostream.

  • Parse error, e.g.:

somefile.cpp:24: parse error before `something'[2]

This could mean that a semi-colon is missing at the end of the previous statement.

Internal Compiler Errors[edit]

An internal compiler error (commonly abbreviated as ICE) is an error that occurs not due to erroneous source code but rather due to a bug in the compiler itself. They can sometimes be worked around by making small, insignificant changes to the source code around the line indicated by the error (if such an line is indicated at all), but sometimes larger changes must be made such as refactoring the code to avoid certain constructs or using a different compiler or different version of the compiler.

Example of an internal compiler error:

somefile.c:1001: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.