### 14.1 Preprocessor error messages ¶

`No such file or directory` ¶

  This error occurs if GCC cannot find a requested file on its search path. The file may have been specified on the command-line, or with a preprocessor `#include` statement. Either the filename has been spelled incorrectly or the directory for the file needs to be added to the include path or link path.

  Example:

      #include <stdoi.h>  /* incorrect */

      int
      main (void)
      {
        printf ("Hello World!\n");
        return 0;
      }

  The program above tries to include the non-existent file `stdoi.h` giving the error ‘`stdoi.h: No such file or directory`’. The correct filename should be `stdio.h`.

`macro or '#include' recursion too deep` ¶
`#include nested too deeply`

  This error occurs if the preprocessor encounters too many nested ‘`#include`’ directives. It is usually caused by two or more files trying to include each other, leading to an infinite recursion.

  Example:

      /* foo.h */
      #include "bar.h"
      ...

      /* bar.h */
      #include "foo.h"
      ...

  The solution to this problem is to ensure that files do not mutually include each other, or to use “include guards” (see Providing your own templates for an example).

`invalid preprocessing directive #...` ¶

  This error indicates that the preprocessor encountered an unrecognized `#` command.

  Example:

      #if FOO
         int x = 1;
      #elsif BAR   /* should be #elif */
         int x = 2;
      #else
         int x = 3;
      #endif

  The preprocessor syntax requires `#elif` for the “else if” condition in `#if` blocks, rather than `#elseif`. In the example above an invalid directive error occurs at the incorrect usage `#elseif`, but only when `FOO` is defined (otherwise the preprocessor ignores everything up to the `#else` statement).

`warning: This file includes at least one deprecated or antiquated header.` ¶

  This warning is generated for C++ programs which include old-style library header files, such as `iostream.h`, instead of the modern C++ library headers without the `.h` extension. The old headers import their functions into the top-level global namespace, instead of using the `std::` namespace. Note that old-style header files are still supported, so this message is only a warning and existing programs will continue to compile. The message is actually generated by a `#warning` directive in the old header files, and not by the preprocessor itself.

  Example:

      #include <iostream.h>  /* old style */

      int
      main (void)
      {
        cout << "Hello World!\n";
        return 0;
      }

  This program uses an old-style header file `iostream.h`. It could be updated to use `#include <iostream>` and `std::cout` instead.