C/C++ preprocessor reference

The C/C++ preprocessor reference explains the preprocessor as it is implemented in Microsoft C/C++. The preprocessor performs preliminary operations on C and C++ files before they are passed to the compiler. You can use the preprocessor to conditionally compile code, insert files, specify compile-time error messages, and apply machine-specific rules to sections of code.

In Visual Studio 2019 the /experimental:preprocessor compiler option enables a new implementation of the preprocessor. The new implementation is still in progress, and is therefore considered experimental. It is intended to eventually be conformant with C99, C11, and C++20. For more information, see MSVC experimental preprocessor overview.

In this section

Provides an overview of the traditional and new experimental preprocessors.

Preprocessor directives
Describes directives, typically used to make source programs easy to change and easy to compile in different execution environments.

Preprocessor operators
Discusses the four preprocessor-specific operators used in the context of the #define directive.

Predefined macros
Discusses predefined macros as specified by ANSI and Microsoft C++.

Discusses pragmas, which offer a way for each compiler to offer machine- and operating system-specific features while retaining overall compatibility with the C and C++ languages.

C++ language reference
Provides reference material for the Microsoft implementation of the C++ language.

C language reference
Provides reference material for the Microsoft implementation of the C language.

C/C++ build reference
Provides links to topics discussing compiler and linker options.

Visual Studio projects - C++
Describes the user interface in Visual Studio that enables you to specify the directories that the project system will search to locate files for your C++ project.