title: c++ & OpenMP : undefined reference to GOMP_loop_dynamic_start
body: <p>I'm stuck in the following problem : at first I compile the following file cancme.cpp :</p>
  
  <pre><code>void funct()
  {
  int i,j,k,N;
  double s;
  #pragma omp parallel for default(none) schedule(dynamic,10) private(i,k,s) shared(j,N)
  for(i=j+1;i&lt;N;i++) {}
  }
  </code></pre>
  
  <p>by:</p>
  
  <pre><code>mingw32-g++.exe -O3 -std=c++11 -mavx -fopenmp -c C:\pathtofile\cancme.cpp -o C:\pathtofile\cancme.o
  </code></pre>
  
  <p>Next I build a second file, test.cpp to simply link cancme.o with  :</p>
  
  <pre><code>int main()
  {
  return(0);
  }
  </code></pre>
  
  <p>by: </p>
  
  <pre><code>mingw32-g++.exe -O3 -std=c++11 -mavx -fopenmp -c C:\pathtofile\test.cpp -o C:\pathtofile\test.o
  </code></pre>
  
  <p>When linking it with cancme.o, by  :</p>
  
  <pre><code>mingw32-g++.exe  -o C:\pathtofile\test.exe C:\pathtofile\test.o  -lgomp  C:\pathtofile\cancme.o
  </code></pre>
  
  <p>I get the following error messages :</p>
  
  <pre><code>C:\pathtofile\cancme.o:cancme.cpp:(.text+0x39): undefined reference to  `GOMP_loop_dynamic_start'
  C:\pathtofile\cancme.o:cancme.cpp:(.text+0x49): undefined reference to `GOMP_loop_dynamic_next'
  C:\pathtofile\cancme.o:cancme.cpp:(.text+0x52): undefined reference to `GOMP_loop_end_nowait'
  C:\pathtofile\cancme.o:cancme.cpp:(.text+0x92): undefined reference to `GOMP_parallel_start'
  C:\pathtofile\cancme.o:cancme.cpp:(.text+0x9f): undefined reference to   `GOMP_parallel_end'
  </code></pre>
  
  <p>Does anyone have an idea about what's going wrong there??? The OpenMP library is correctly linked by the <code>-lgomp</code> flag but it is like it was not recognized.</p>
  
  <p>note : I use MingW 4.8.1 c++ compiler under windows 7 64 bit:</p>
  
  <p>thank you </p>
  
  <p>renato</p>