Compiler Error C3048
Expression following '#pragma omp atomic' has improper form
An atomic directive was incorrectly specified.
The following sample generates C3048:
// C3048.cpp
// compile with: /openmp vcomps.lib
#include "omp.h"
#include <stdio.h>
int main() {
int a[10];
omp_set_num_threads(4);
#pragma omp parallel
{
#pragma omp atomic
a[0] = 1; // C3048
// try the following line instead
// a[0] += 1;
}
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for