title: c++ omp atomic capture - syntax?
body: <p>Very simple code, cannot see why compiler throws an error about my use of <code>omp atomic capture</code></p>
  
  <p>// my_class.h</p>
  
  <pre><code>class my_class
  {
  
  my_class()
  { }
  
  static int class_int;
  static int get_next_int();
  
  };
  </code></pre>
  
  <p>// my_class.cpp</p>
  
  <pre><code>int my_class::get_next_int()
  {
     int next_int;
    #pragma omp atomic capture
    next_int = class_int++;
  
    return next_int;
  }
  </code></pre>
  
  <p>Compiler error:</p>
  
  <pre><code>my_class.cpp: In static member function 'static int 
  my_class::get_next_int()':
  
  my_class.cpp:2069: error: expected end of line before 'capture'
  my_class.cpp:2070: error: invalid operator for '#pragma omp atomic' before '=' token
  </code></pre>
  
  <p>Might it have something to do with <code>static</code>?  I can't imagine why...</p>
  
  <p>If I use <code>pragma omp critical</code> instead, then it works fine (no compiler error).</p>
  
  <p>PS  I have  <code>#include &lt;omp.h&gt;</code>  in all .h and .cpp.   And I link with <code>-fopenmp</code> , as usual</p>