Pelles C forum

Pelles C => General discussions => Topic started by: Abraham on October 07, 2018, 09:42:06 PM

Title: Version 9.00.9 "i is not unsigned type" error #2918.
Post by: Abraham on October 07, 2018, 09:42:06 PM
Code: [Select]
#include <stdio.h>
#define ITERATIONS 100000000
int main(void)
{
    double pi = 0;
    long i;

    /* pi/4 = 1/1 - 1/3 + 1/5 - 1/7 + ... */
    #pragma omp parallel for reduction(+:pi)
    for (i = 0; i < ITERATIONS; i++)
    {
        pi += 1.0 / (i * 4.0 + 1.0);
        pi -= 1.0 / (i * 4.0 + 3.0);
    }
    pi = pi * 4.0;
    printf("pi = %f\n", pi);

    return 0;
}

error #2918: [omp] Unrecognized or unsupported form of 'for' construct.

The only way to solve this issue is to change i to size_t.

Edit:
I made a mistake. The iterater only needs to be unsigned type. It failed with signed types.

Edit:
Changed the Subject, not sure if it would change the title of the thread.