undefined reference to `omp_get_num_procs'
<pre><code># include &lt;cstdlib&gt;
# include &lt;iostream&gt;
# include &lt;iomanip&gt;
# include &lt;omp.h&gt;

using namespace std;

int main ( int argc, char *argv[] );

//********************************
int main ( int argc, char *argv[] )
//**********************************
{
  int id;
  double wtime;

  cout &lt;&lt; "\n";
  cout &lt;&lt; "HELLO_OPENMP\n";
  cout &lt;&lt; "  C++/OpenMP version\n";

  cout &lt;&lt; "\n";
  cout &lt;&lt; "  Number of processors available = " &lt;&lt; omp_get_num_procs ( ) &lt;&lt; "\n";
  cout &lt;&lt; "  Number of threads =              " &lt;&lt; omp_get_max_threads ( ) &lt;&lt; "\n";

  wtime = omp_get_wtime ( );

# pragma omp parallel \
  private ( id )
  {
    id = omp_get_thread_num ( );
    cout &lt;&lt; "  This is process " &lt;&lt; id &lt;&lt; "\n";
  }
  wtime = omp_get_wtime ( ) - wtime;

  cout &lt;&lt; "\n";
  cout &lt;&lt; "HELLO_OPENMP\n";
  cout &lt;&lt; "  Normal end of execution.\n";

  cout &lt;&lt; "\n";
  cout &lt;&lt; "  Elapsed wall clock time = " &lt;&lt; wtime &lt;&lt; "\n";

  return 0;
}
</code></pre>

<p>Hello,
I try to run this program:</p>

<p>I run make "filename"       and I had this error:</p>

<p>g++     hello_openmp.cpp   -o hello_openmp
/tmp/ccz80Tfg.o: In function <code>main':
hello_openmp.cpp:(.text+0x4d): undefined reference to</code>omp_get_num_procs'
hello_openmp.cpp:(.text+0x7a): undefined reference to <code>omp_get_max_threads'
hello_openmp.cpp:(.text+0xa7): undefined reference to</code>omp_get_wtime'
hello_openmp.cpp:(.text+0xb9): undefined reference to <code>omp_get_thread_num'
hello_openmp.cpp:(.text+0xea): undefined reference to</code>omp_get_wtime'
collect2: error: ld returned 1 exit status
make: *** [hello_openmp] Error 1</p>

<p>Is anyone knows what is the meaning of this error.
Sorry I am beginner in C++.
Thank you</p>