C Tutorial/Preprocessor/error

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Error directive

specify an error message


<source lang="cpp">//#define USA 1 //#define EUP 1

  1. include <stdio.h>
  1. if (!defined (USA) || !defined (EUP))
  #error ERROR: NO_CURRENCY rate is specified.
  1. endif

main() {

   int rs;
   rs = 10;
   printf ("%d\n", rs);

}</source>

ERRORDIRECTIVE0.c:8:5: error: #error ERROR: NO_CURRENCY rate is specified.