#line directive | Changes the line number in error messages |
#line digits #line digits string |
The #line directive changes the compiler's notion of the current filename and line number. The first form changes the line number (as expressed by the _ _LINE_ _ directive and used in error messages) to digits. The second form changes the line number to digits and the filename to the contents of string. The new file name is used as the value of the _ _FILE_ _ macro.
The #line directive is typically used by programs that generate C++ as output from some other input. The directive records the original filename and line number that produced the C++ code. Error messages and debuggers can point to the original file instead of to the intermediate C++ source file.
#error directive