Error and Warning - C Preprocessor

C examples for Preprocessor:Preprocessor Operators

Introduction

The #error directive stops the compilation.

It can take a parameter that specifies the error description.

#error "Compilation aborted for no reason"

Many C compilers have the non-standard directive #warning.

This directive displays a warning message without aborting the compilation.

#warning "this is a test."

Directive #line can change the displayed line number when an error occurs during compilation.

#line 5 "myapp.c"

Pragma

#pragma can specify options to the compiler.


Related Tutorials