次の方法で共有


A.2 Specifying Conditional Compilation

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The following examples illustrate the use of conditional compilation using the OpenMP macro _OPENMP (Section 2.2 on page 8). With OpenMP compilation, the _OPENMP macro becomes defined.

# ifdef _OPENMP   
    printf_s("Compiled by an OpenMP-compliant implementation.\n");  
# endif  

The defined preprocessor operator allows more than one macro to be tested in a single directive.

# if defined(_OPENMP) && defined(VERBOSE)  
    printf_s("Compiled by an OpenMP-compliant implementation.\n");  
# endif