title: OpenMp Task: can't pass argument by reference
body: <p><code>g++ -fopenmp main.cpp</code> complains about undefined reference to <code>std::vector</code>. How to fix this?</p>
  
  <p>I have installed the <code>libomp-dev</code> package on Ubuntu.</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include&lt;vector&gt;
  #include&lt;iostream&gt;
  
  template&lt;typename T, typename A&gt;
  T recursiveSumBody(std::vector&lt;T, A&gt; &amp;vec) {
      T sum = 0;
      #pragma omp task shared(sum)
      {
          sum = recursiveSumBody(vec);
      }
      return vec[0];
  }
  
  int main() {
      std::vector&lt;int&gt; a;
      recursiveSumBody(a);
      return 0;
  }
  </code></pre>
  
  <p>Undefined References</p>
  
  <pre><code>/tmp/ccTDECNm.o: In function `int recursiveSumBody&lt;int, std::allocator&lt;int&gt; &gt;(std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;) [clone ._omp_cpyfn.1]':
  main.cpp:(.text+0x148): undefined reference to `std::vector&lt;int, std::allocator&lt;int&gt; &gt;::vector(std::vector&lt;int, std::allocator&lt;int&gt; &gt; const&amp;)'
  collect2: error: ld returned 1 exit status
  </code></pre>