Option Type | Default Value | #pragma options | C | C++ |
-qoption | noonce | ONCE | x | x |
Syntax
-qonce | -qnoonce ONCE | NOONCE
Purpose
Avoids including a header file more than once even if it is
specified in several of the files you are compiling.
Notes
The compiler uses the full path name to determine if a file
has already been included. No attempt is made to resolve .
or .. in the path name. #include
statements that include . or ..
in the path statements may cause the same file to be included
more than once.
The #pragma options keyword ONCE may appear anywhere in your code. It can be turned on and off by specifying ONCE and NOONCE, respectively.
Important! |
Do not use the -qonce option if both
of the following conditions are true:
va_list must be defined twice to have any effect, and -qonce defeats this purpose. |
Example
The following example shows how the compiler resolves
whether a file has already been included.
#include <stdio.h> /* Found in /usr/include/stdio.h */ #include <stdio.h> /* Already included */ #include </usr/include/stdio.h> /* Already included */ #include <./stdio.h> /* Resolves to /usr/include/./stdio.h */ /* which is the same file, but this */ /* file will be included again. */