Ошибка c3001 taskwait требуется имя директивы openmp

C++ Documentation. Contribute to MicrosoftDocs/cpp-docs development by creating an account on GitHub.
description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler errors C3000 Through C3099

Compiler errors C3000 Through C3099

06/01/2022

C3051

C3061

C3064

C3067

C3074

C3078

C3079

C3081

C3082

C3086

C3088

C3089

C3090

C3091

C3092

C3093

C3098

C3051

C3061

C3064

C3067

C3074

C3078

C3079

C3081

C3082

C3086

C3088

C3089

C3090

C3091

C3092

C3093

C3098

01b7b9cb-b351-4b5a-8cb0-1fcddb08d2ab

Compiler errors C3000 Through C3099

The articles in this section of the documentation explain a subset of the error messages that are generated by the compiler.

[!INCLUDEerror-boilerplate]

Error messages

Error Message
Compiler error C3000 symbol‘: use of class template requires template argument list. Argument deduction is not allowed in non-static data member.
Compiler error C3001 message‘: expected an OpenMP directive name
Compiler error C3002 name1 name2‘: multiple OpenMP directive names
Compiler error C3003 directive‘: OpenMP directive name not allowed after directive clauses
Compiler error C3004 clause‘: clause not valid on OpenMP ‘directive‘ directive
Compiler error C3005 message‘: unexpected token encountered on OpenMP ‘directive‘ directive
Compiler error C3006 clause‘: clause on OpenMP ‘directive‘ directive is missing an expected argument
Compiler error C3007 clause‘: clause on OpenMP ‘directive‘ directive does not take an argument
Compiler error C3008 argument‘: argument is missing closing ‘)’ on OpenMP ‘directive‘ directive
Compiler error C3009 label‘: jump into OpenMP structured block not allowed
Compiler error C3010 label‘: jump out of OpenMP structured block not allowed
Compiler error C3011 inline assembly not allowed directly within a parallel region
Compiler error C3012 function‘: intrinsic function not allowed directly within a parallel region
Compiler error C3013 clause‘: clause may only appear once on OpenMP ‘directive‘ directive
Compiler error C3014 expected a for loop following OpenMP ‘directive‘ directive
Compiler error C3015 initialization in OpenMP ‘for’ statement has improper form
Compiler error C3016 identifier‘: index variable in OpenMP ‘for’ statement must have signed integral type
Compiler error C3017 termination test in OpenMP ‘for’ statement has improper form
Compiler error C3018 identifier‘: OpenMP ‘for’ test or increment must use index variable ‘variable
Compiler error C3019 increment in OpenMP ‘for’ statement has improper form
Compiler error C3020 variable‘: index variable of OpenMP ‘for’ loop cannot be modified in loop body
Compiler error C3021 argument‘: argument is empty on OpenMP ‘directive‘ directive
Compiler error C3022 directive‘: invalid schedule kind of ‘directive‘ on OpenMP ‘directive‘ directive
Compiler error C3023 argument‘: unexpected token encountered in argument to OpenMP ‘directive‘ clause
Compiler error C3024 ‘schedule(runtime)’: chunk_size expression is not allowed
Compiler error C3025 clause‘: integral expression expected
Compiler error C3026 clause‘: constant expression must be positive
Compiler error C3027 clause‘: arithmetic or pointer expression expected
Compiler error C3028 member‘: only a variable or static data member can be used in a data-sharing clause
Compiler error C3029 symbol‘: can only appear once in data-sharing clauses in an OpenMP directive
Compiler error C3030 identifier‘: variable in ‘directive‘ clause/directive cannot have reference type
Compiler error C3031 identifier‘: variable in ‘reduction’ clause must have scalar arithmetic type
Compiler error C3032 identifier‘: variable in ‘clause‘ clause cannot have incomplete type ‘type
Compiler error C3033 identifier‘: variable in ‘clause‘ clause cannot have const-qualified type
Compiler error C3034 OpenMP ‘directive‘ directive cannot be directly nested within ‘directive‘ directive
Compiler error C3035 OpenMP ‘ordered’ directive must bind directly to a ‘for’ or ‘parallel for’ directive with the ‘ordered’ clause
Compiler error C3036 clause‘: invalid operator token in OpenMP ‘reduction’ clause
Compiler error C3037 identifier‘: variable in ‘clause‘ clause must be shared in enclosing context
Compiler error C3038 identifier‘: variable in ‘private’ clause cannot be a reduction variable in enclosing context
Compiler error C3039 identifier‘: index variable in OpenMP ‘for’ statement cannot be a reduction variable
Compiler error C3040 identifier‘: type of variable in ‘reduction’ clause is incompatible with reduction operator ‘operator
Compiler error C3041 identifier‘: variable in ‘copyprivate’ clause must be private in enclosing context
Compiler error C3042 ‘copyprivate’ and ‘nowait’ clauses cannot appear together on OpenMP ‘directive‘ directive
Compiler error C3043 OpenMP ‘critical’ directive cannot be nested in ‘critical’ directive with same name
Compiler error C3044 ‘section’: only allowed directly nested under an OpenMP ‘sections’ directive
Compiler error C3045 Expected a compound statement following OpenMP ‘sections’ directive. Missing ‘{‘
Compiler error C3046 Missing structured block in an OpenMP ‘#pragma omp sections’ region
Compiler error C3047 Structured block in an OpenMP ‘sections’ region must be preceded by ‘#pragma omp section’ (Obsolete in Visual Studio 2022.)
Compiler error C3048 Expression following ‘#pragma omp atomic’ has improper form
Compiler error C3049 argument‘: invalid argument in OpenMP ‘default’ clause
Compiler error C3050 class‘: a ref class cannot inherit from ‘identifier
Compiler error C3051 Obsolete.
Compiler error C3052 identifier‘: variable doesn’t appear in a data-sharing clause under a default(none) clause
Compiler error C3053 identifier‘: ‘threadprivate’ is only valid for global or static data items
Compiler error C3054 ‘#pragma omp parallel’ is currently not supported in a generic class or function (Obsolete in Visual Studio 2022.)
Compiler error C3055 identifier‘: symbol cannot be referenced before it is used in ‘threadprivate’ directive
Compiler error C3056 identifier‘: symbol is not in the same scope with ‘threadprivate’ directive
Compiler error C3057 identifier‘: dynamic initialization of ‘threadprivate’ symbols is not currently supported
Compiler error C3058 identifier‘: symbol not declared as ‘threadprivate’ before it is used in the ‘copyin’ clause
Compiler error C3059 identifier‘: ‘threadprivate’ symbol cannot be used in the ‘clause‘ clause
Compiler error C3060 identifier‘: a friend function may not be defined inside a class using a qualified name (it may only be declared)
Compiler error C3061 operator ‘operator‘: not allowed on enumeration ‘type‘ with underlying type ‘type
Compiler error C3062 identifier‘: enumerator requires value since the underlying type is ‘type
Compiler error C3063 operator ‘operator‘: all operands must have the same enumeration type
Compiler error C3064 identifier‘: must be a simple type or resolve to one
Compiler error C3065 property declaration at non-class scope is not allowed
Compiler error C3066 there are multiple ways that an object of this type can be called with these arguments
Compiler error C3067 an initializer list cannot be used with the built-in operator[]
Compiler error C3068 identifier‘: a ‘naked’ function cannot contain objects that would require unwinding if a C++ exception occurred
Compiler error C3069 operator ‘operator‘: not allowed for enumeration type
Compiler error C3070 identifier‘: property does not have a ‘set’ method
Compiler error C3071 operator ‘operator‘ can only be applied to an instance of a ref class or a value-type
Compiler error C3072 operator ‘operator‘ cannot be applied to an instance of a ref class use the unary ‘%’ operator to convert an instance of a ref class to a handle type
Compiler error C3073 identifier‘: ref class does not have a user-defined copy constructor
Compiler error C3074 an array cannot be initialized with a parenthesized initializer
Compiler error C3075 identifier‘: you cannot embed an instance of a reference type, ‘type‘, in a value-type
Compiler error C3076 identifier‘: you cannot embed an instance of a reference type, ‘type‘, in a native type
Compiler error C3077 identifier‘: a finalizer can only be a member of a reference type
Compiler error C3078 array size must be specified in new expressions
Compiler error C3079 an initializer list cannot be used as the right operand of this assignment operator
Compiler error C3080 finalizer‘: a finalizer cannot have a storage-class-specifier
Compiler error C3081 Obsolete.
Compiler error C3082 Obsolete.
Compiler error C3083 identifier‘: the symbol to the left of a ‘::’ must be a type
Compiler error C3084 identifier‘: a destructor/finalizer cannot be ‘keyword
Compiler error C3085 identifier‘: a constructor cannot be ‘keyword
Compiler error C3086 cannot find ‘std::initializer_list’: you need to #include <initializer_list>
Compiler error C3087 identifier‘: call of ‘declaration‘ already initializes this member
Compiler error C3088 class‘: attribute constructor must have named formal arguments
Compiler error C3089 identifier‘: parameter name does not match any data member’s name
Compiler error C3090 class‘: attribute class cannot be a template
Compiler error C3091 class‘: attribute class cannot have base classes
Compiler error C3092 class‘: attribute class member cannot be a bit field, ‘static’ or ‘const’
Compiler error C3093 type‘: type not allowed for attribute class member ‘member
Compiler error C3094 attribute‘: anonymous usage not allowed
Compiler error C3095 attribute‘: attribute cannot be repeated
Compiler error C3096 attribute‘: attribute is allowed on data members of attribute classes only
Compiler error C3097 attribute‘: attribute must be scoped with ‘assembly:’ or ‘module:’
Compiler error C3098 identifier‘: attribute has no user-defined constructors
Compiler error C3099 keyword‘: use [System::AttributeUsageAttribute]/[Windows::Foundation::Metadata::AttributeUsageAttribute] for managed/WinRT attributes

See also

C/C++ Compiler and build tools errors and warnings
Compiler errors C2000 — C3999, C7000 — C7999

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler errors C3000 Through C3099

Compiler errors C3000 Through C3099

06/01/2022

C3051

C3061

C3064

C3067

C3074

C3078

C3079

C3081

C3082

C3086

C3088

C3089

C3090

C3091

C3092

C3093

C3098

C3051

C3061

C3064

C3067

C3074

C3078

C3079

C3081

C3082

C3086

C3088

C3089

C3090

C3091

C3092

C3093

C3098

01b7b9cb-b351-4b5a-8cb0-1fcddb08d2ab

Compiler errors C3000 Through C3099

The articles in this section of the documentation explain a subset of the error messages that are generated by the compiler.

[!INCLUDEerror-boilerplate]

Error messages

Error Message
Compiler error C3000 symbol‘: use of class template requires template argument list. Argument deduction is not allowed in non-static data member.
Compiler error C3001 message‘: expected an OpenMP directive name
Compiler error C3002 name1 name2‘: multiple OpenMP directive names
Compiler error C3003 directive‘: OpenMP directive name not allowed after directive clauses
Compiler error C3004 clause‘: clause not valid on OpenMP ‘directive‘ directive
Compiler error C3005 message‘: unexpected token encountered on OpenMP ‘directive‘ directive
Compiler error C3006 clause‘: clause on OpenMP ‘directive‘ directive is missing an expected argument
Compiler error C3007 clause‘: clause on OpenMP ‘directive‘ directive does not take an argument
Compiler error C3008 argument‘: argument is missing closing ‘)’ on OpenMP ‘directive‘ directive
Compiler error C3009 label‘: jump into OpenMP structured block not allowed
Compiler error C3010 label‘: jump out of OpenMP structured block not allowed
Compiler error C3011 inline assembly not allowed directly within a parallel region
Compiler error C3012 function‘: intrinsic function not allowed directly within a parallel region
Compiler error C3013 clause‘: clause may only appear once on OpenMP ‘directive‘ directive
Compiler error C3014 expected a for loop following OpenMP ‘directive‘ directive
Compiler error C3015 initialization in OpenMP ‘for’ statement has improper form
Compiler error C3016 identifier‘: index variable in OpenMP ‘for’ statement must have signed integral type
Compiler error C3017 termination test in OpenMP ‘for’ statement has improper form
Compiler error C3018 identifier‘: OpenMP ‘for’ test or increment must use index variable ‘variable
Compiler error C3019 increment in OpenMP ‘for’ statement has improper form
Compiler error C3020 variable‘: index variable of OpenMP ‘for’ loop cannot be modified in loop body
Compiler error C3021 argument‘: argument is empty on OpenMP ‘directive‘ directive
Compiler error C3022 directive‘: invalid schedule kind of ‘directive‘ on OpenMP ‘directive‘ directive
Compiler error C3023 argument‘: unexpected token encountered in argument to OpenMP ‘directive‘ clause
Compiler error C3024 ‘schedule(runtime)’: chunk_size expression is not allowed
Compiler error C3025 clause‘: integral expression expected
Compiler error C3026 clause‘: constant expression must be positive
Compiler error C3027 clause‘: arithmetic or pointer expression expected
Compiler error C3028 member‘: only a variable or static data member can be used in a data-sharing clause
Compiler error C3029 symbol‘: can only appear once in data-sharing clauses in an OpenMP directive
Compiler error C3030 identifier‘: variable in ‘directive‘ clause/directive cannot have reference type
Compiler error C3031 identifier‘: variable in ‘reduction’ clause must have scalar arithmetic type
Compiler error C3032 identifier‘: variable in ‘clause‘ clause cannot have incomplete type ‘type
Compiler error C3033 identifier‘: variable in ‘clause‘ clause cannot have const-qualified type
Compiler error C3034 OpenMP ‘directive‘ directive cannot be directly nested within ‘directive‘ directive
Compiler error C3035 OpenMP ‘ordered’ directive must bind directly to a ‘for’ or ‘parallel for’ directive with the ‘ordered’ clause
Compiler error C3036 clause‘: invalid operator token in OpenMP ‘reduction’ clause
Compiler error C3037 identifier‘: variable in ‘clause‘ clause must be shared in enclosing context
Compiler error C3038 identifier‘: variable in ‘private’ clause cannot be a reduction variable in enclosing context
Compiler error C3039 identifier‘: index variable in OpenMP ‘for’ statement cannot be a reduction variable
Compiler error C3040 identifier‘: type of variable in ‘reduction’ clause is incompatible with reduction operator ‘operator
Compiler error C3041 identifier‘: variable in ‘copyprivate’ clause must be private in enclosing context
Compiler error C3042 ‘copyprivate’ and ‘nowait’ clauses cannot appear together on OpenMP ‘directive‘ directive
Compiler error C3043 OpenMP ‘critical’ directive cannot be nested in ‘critical’ directive with same name
Compiler error C3044 ‘section’: only allowed directly nested under an OpenMP ‘sections’ directive
Compiler error C3045 Expected a compound statement following OpenMP ‘sections’ directive. Missing ‘{‘
Compiler error C3046 Missing structured block in an OpenMP ‘#pragma omp sections’ region
Compiler error C3047 Structured block in an OpenMP ‘sections’ region must be preceded by ‘#pragma omp section’ (Obsolete in Visual Studio 2022.)
Compiler error C3048 Expression following ‘#pragma omp atomic’ has improper form
Compiler error C3049 argument‘: invalid argument in OpenMP ‘default’ clause
Compiler error C3050 class‘: a ref class cannot inherit from ‘identifier
Compiler error C3051 Obsolete.
Compiler error C3052 identifier‘: variable doesn’t appear in a data-sharing clause under a default(none) clause
Compiler error C3053 identifier‘: ‘threadprivate’ is only valid for global or static data items
Compiler error C3054 ‘#pragma omp parallel’ is currently not supported in a generic class or function (Obsolete in Visual Studio 2022.)
Compiler error C3055 identifier‘: symbol cannot be referenced before it is used in ‘threadprivate’ directive
Compiler error C3056 identifier‘: symbol is not in the same scope with ‘threadprivate’ directive
Compiler error C3057 identifier‘: dynamic initialization of ‘threadprivate’ symbols is not currently supported
Compiler error C3058 identifier‘: symbol not declared as ‘threadprivate’ before it is used in the ‘copyin’ clause
Compiler error C3059 identifier‘: ‘threadprivate’ symbol cannot be used in the ‘clause‘ clause
Compiler error C3060 identifier‘: a friend function may not be defined inside a class using a qualified name (it may only be declared)
Compiler error C3061 operator ‘operator‘: not allowed on enumeration ‘type‘ with underlying type ‘type
Compiler error C3062 identifier‘: enumerator requires value since the underlying type is ‘type
Compiler error C3063 operator ‘operator‘: all operands must have the same enumeration type
Compiler error C3064 identifier‘: must be a simple type or resolve to one
Compiler error C3065 property declaration at non-class scope is not allowed
Compiler error C3066 there are multiple ways that an object of this type can be called with these arguments
Compiler error C3067 an initializer list cannot be used with the built-in operator[]
Compiler error C3068 identifier‘: a ‘naked’ function cannot contain objects that would require unwinding if a C++ exception occurred
Compiler error C3069 operator ‘operator‘: not allowed for enumeration type
Compiler error C3070 identifier‘: property does not have a ‘set’ method
Compiler error C3071 operator ‘operator‘ can only be applied to an instance of a ref class or a value-type
Compiler error C3072 operator ‘operator‘ cannot be applied to an instance of a ref class use the unary ‘%’ operator to convert an instance of a ref class to a handle type
Compiler error C3073 identifier‘: ref class does not have a user-defined copy constructor
Compiler error C3074 an array cannot be initialized with a parenthesized initializer
Compiler error C3075 identifier‘: you cannot embed an instance of a reference type, ‘type‘, in a value-type
Compiler error C3076 identifier‘: you cannot embed an instance of a reference type, ‘type‘, in a native type
Compiler error C3077 identifier‘: a finalizer can only be a member of a reference type
Compiler error C3078 array size must be specified in new expressions
Compiler error C3079 an initializer list cannot be used as the right operand of this assignment operator
Compiler error C3080 finalizer‘: a finalizer cannot have a storage-class-specifier
Compiler error C3081 Obsolete.
Compiler error C3082 Obsolete.
Compiler error C3083 identifier‘: the symbol to the left of a ‘::’ must be a type
Compiler error C3084 identifier‘: a destructor/finalizer cannot be ‘keyword
Compiler error C3085 identifier‘: a constructor cannot be ‘keyword
Compiler error C3086 cannot find ‘std::initializer_list’: you need to #include <initializer_list>
Compiler error C3087 identifier‘: call of ‘declaration‘ already initializes this member
Compiler error C3088 class‘: attribute constructor must have named formal arguments
Compiler error C3089 identifier‘: parameter name does not match any data member’s name
Compiler error C3090 class‘: attribute class cannot be a template
Compiler error C3091 class‘: attribute class cannot have base classes
Compiler error C3092 class‘: attribute class member cannot be a bit field, ‘static’ or ‘const’
Compiler error C3093 type‘: type not allowed for attribute class member ‘member
Compiler error C3094 attribute‘: anonymous usage not allowed
Compiler error C3095 attribute‘: attribute cannot be repeated
Compiler error C3096 attribute‘: attribute is allowed on data members of attribute classes only
Compiler error C3097 attribute‘: attribute must be scoped with ‘assembly:’ or ‘module:’
Compiler error C3098 identifier‘: attribute has no user-defined constructors
Compiler error C3099 keyword‘: use [System::AttributeUsageAttribute]/[Windows::Foundation::Metadata::AttributeUsageAttribute] for managed/WinRT attributes

See also

C/C++ Compiler and build tools errors and warnings
Compiler errors C2000 — C3999, C7000 — C7999

2 / 2 / 0

Регистрация: 26.09.2014

Сообщений: 45

1

25.01.2015, 13:08. Показов 3665. Ответов 1


Сижу быструю сортировку распараллеливаю.
Использую подручные средства, а именно Visual Studio 2013 Ultimate.
Программа никак не хочет компилироваться.
Пишет следующее: «error C3001: ‘task’ : expected an OpenMP directive name»
Код ниже:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <omp.h>
#include <algorithm>
#include <stdio.h>
#include <time.h>
 
//#define DEBUG
 
/*!
* quickSort - реализация алгоритма быстрой сортировки
* @param num номер вызова функции (для отладки)
* @param a сортируемый массив
* @param n индекс последнего элемента массива (не размер массива!)
*/
void quickSort(int num, float* a, const long n) {
    long i = 0, j = n;
    float   pivot = a[n / 2]; // опорный элемент
 
#ifdef DEBUG
#pragma omp critical
    {
        printf("enter: %dn", num);
    }
#endif
 
    do {
        while (a[i] < pivot) i++;
        while (a[j] > pivot) j--;
 
        if (i <= j) {
            std::swap(a[i], a[j]);
            i++; j--;
        }
    } while (i <= j);
 
#ifdef DEBUG
#pragma omp critical
    {
        printf("divide #%d by %3.2f [%d] -> (%d|%d) : %dn", num, pivot, n / 2, j, n - i, n);
    }
#endif
 
    if (n < 100) {
        if (j > 0) quickSort(num * 2 + 1, a, j);
        if (n > i) quickSort(num * 2 + 2, a + i, n - i);
        return;
    }
 
#pragma omp task shared(a)
    {
        if (j > 0) quickSort(num * 2 + 1, a, j);
    } // #pragma omp task
#pragma omp task shared(a)
    {
        if (n > i) quickSort(num * 2 + 2, a + i, n - i);
    } // #pragma omp task
#pragma omp taskwait
}
int main(int argc, char *argv[]) {
 
    if (argc < 2) {
        printf("error argn");
        return 1;
    }
 
    float *a;
    long n;
 
    sscanf(argv[1], "%d", &n);
 
    a = new float[n];
 
    srand(time(NULL));
    for (int i = 0; i < n; ++i)
        a[i] = rand() % 10;
 
#ifdef DEBUG
    for (int i = 0; i < n; ++i)
        printf("%3.2f ", a[i]);
    printf("n");
#endif
 
#pragma omp parallel shared(a)
    {
#pragma omp single nowait 
        {
            quickSort(0, a, n - 1);
        } // #pragma omp single
    } // #pragma omp parallel
 
    /* проверка правильности сортировки
    for (int i = 1; i < n; ++i) {
    if (a[i] < a[i-1])
    printf("errorn");
    }
    */
 
    delete[]a;
}

В настройках проекта в Configuration Properties -> C++ -> Language -> Open MP Support поставить Yes не забыл.
Заголовочный файл omp.h в коде подключил.
Что ему не нравится? Что надо добавить или подключить, чтобы на task не ругался?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Понравилась статья? Поделить с друзьями:
  • Ошибка d262 форд фокус 1
  • Ошибка c2552 konica minolta
  • Ошибка d262 форд мондео 3
  • Ошибка c241301 kia rio
  • Ошибка cummins 449