Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 1.39 KB

compiler-error-c3021.md

File metadata and controls

72 lines (53 loc) · 1.39 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C3021
Compiler Error C3021
11/04/2016
C3021
C3021
0cef6d97-e267-438a-ac8b-0daf5bbbc2cf

Compiler Error C3021

'arg' : argument is empty on OpenMP directive 'directive'

An argument is required for an OpenMP directive.

Example

The following sample generates C3021:

// C3021.cpp
// compile with: /openmp
#include <stdio.h>
#include "omp.h"

int g = 0;

int main()
{
    int x, y, i;

    #pragma omp parallel for schedule(static,)   // C3021
    for (i = 0; i < 10; ++i) ;

    #pragma omp parallel for schedule()   // C3021
    for (i = 0; i < 10; ++i)
        printf_s("Hello world, thread %d, iteration %d\n",
                 omp_get_thread_num(), i);

    #pragma omp parallel reduction()   // C3021
      ;

    #pragma omp parallel reduction(+ :)   // C3021
      ;

    //
    // The following shows correct syntax examples.
    //
    #pragma omp parallel reduction(+ : x, y)
      ;

    #pragma omp parallel reduction(* : x, y)
      ;

    #pragma omp parallel reduction(- : x, y)
      ;

    #pragma omp parallel reduction(& : x, y)
      ;

    #pragma omp parallel reduction(^ : x, y)
      ;

    #pragma omp parallel reduction(| : x, y)
      ;

    #pragma omp parallel reduction(&& : x, y)
      ;

    #pragma omp parallel reduction(|| : x, y)
      ;
}