Main Content

Header guard style

Style of preprocessor directive in generated code

Description

App Configuration Pane: Code Appearance

Configuration Objects: coder.CodeConfig | coder.EmbeddedCodeConfig

To prevent compilation errors due to multiple inclusion of header files, the code generator produces either #ifndef or #pragma once constructs in generated header files. If your project uses distinct files that use the same preprocessor macros, then generate code with the #pragma once construct. The compilation behavior of #pragma once is not standardized.

Settings

Use include guard

This setting is the default setting.

The code generator produces #ifndef style #include guards.

Use pragma once

The code generator produces #pragma once style #include guards.

Programmatic Use

Property: HeaderGuardStyle
Values: UseIncludeGuard | UsePragmaOnce
Default: UseIncludeGuard

Version History

Introduced in R2019b