omp for with collapse clause is not compiling

c++, multithreading, openmp

Solution

`collapse` is an OpenMP 3.0 pragma. The error message you received is usually due to a compiler that implements OpenMP 2.x only.

Problem

I am parallelizing with a parallel `for` construct in OpenMP. In OpenMP specs, I can see: ``` void sub(float *a) { int i, j, k; #pragma omp for collapse(2) private(i, k, j) for (k=kl; k<=ku; k+=ks) for (j=jl; j<=ju; j+=js) for (i=il; i<=iu; i+=is) bar(a,i,j,k); } ``` I've written code that I find quite similar, but it does not compile: unexpected token after collapse clause ``` #pragma omp for collapse(2) for(int i=0;i<N-m;i++) for(int k=0;k<m_ndim;k++) points_[i][k]=TRandom::randD(lower[k],upper[k]); ``` Why isn't it working?

Original source