once

Controls whether or not a header file can be included more than once in the same compilation unit.

Syntax
  #pragma once [ on ]   
Remarks

Use this pragma to ensure that the compiler includes header files only once in a source file. This pragma is especially useful in precompiled header files.

There are two versions of this pragma:

  #pragma once   

and

  #pragma once on   

Use #pragma once in a header file to ensure that the header file is included only once in a source file. Use #pragma once on in a header file or source file to ensure that any file is included only once in a source file.

Beware that when using #pragma once on, precompiled headers transferred from one host machine to another might not give the same results during compilation. This inconsistency is because the compiler stores the full paths of included files to distinguish between two distinct files that have identical file names but different paths. Use the warn_pch_portability pragma to issue a warning message when you use #pragma once on in a precompiled header.

Also, if you enable the old_pragma_once on pragma, the once pragma completely ignores path names.

This pragma does not correspond to any panel setting. By default, this pragma is off.