Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22271

OpenMP invalid controlling predicate - persistent

$
0
0

I keep getting this error for >6 hours now when trying to compile C-code with -fopenmp flag using gcc.

error: invalid controlling predicate for ( int i = 0; i < N; i++ )

I browsed stackoverflow and I stripped down my code up till the point where it is an exact copy of an example from an OpenMP handbook, but still it doesn't compile.

#include <stdio.h>
#include <math.h>
#ifdef _OPENMP
#include <omp.h>
#endif

int main(int argc, char *argv[]) {
    double N; sscanf (argv[1]," %lf", &N);
    double integral = 0.0;

    #pragma omp parallel for reduction(+: integral)
        for ( int i = 0; i < N; i++ )
            integral = integral + i;

    printf("%20.18lf\n", integral);
    return 0;
}

Any suggestions..?


Viewing all articles
Browse latest Browse all 22271

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>