title: Open MPI "Hello, World!" is not compiling
body: <p>Here is a simple MPI "Hello, World!" program.</p>
  
  <pre class="lang-c++ prettyprint-override"><code>#include &lt;stdio.h&gt;
  #include &lt;mpi.h&gt;
  
  int main(int argc, char **argv)
  {
     int size, rank;
     MPI_Init(&amp;argc, &amp;argv);
     MPI_Comm_size(MPI_COMM_WORLD, &amp;size);
     MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
     printf("SIZE = %d RANK = %d\n",size,rank);
     MPI_Finalize();   
     return(0);
  }
  </code></pre>
  
  <p>However, it doesn't seem to compile:</p>
  
  <pre><code>Undefined                       first referenced
   symbol                             in file
  MPI::Datatype::Free()               /var/tmp//ccE6aG2w.o
  MPI::Win::Free()                    /var/tmp//ccE6aG2w.o
  MPI::Comm::Comm()                   /var/tmp//ccE6aG2w.o
  ld: fatal: symbol referencing errors. No output written to main
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>I've googled a lot, viewed mailing lists, thousands of them. They say <code>libmpi_cxx</code> is not linking. But it's in the compiler flags.</p>
  
  <p>Here is <code>--showme</code> data:</p>
  
  <pre><code>mpic++ --showme:compile
  -I/usr/openmpi/ompi-1.5/include -I/usr/openmpi/ompi-1.5/include/openmpi
  
  mpic++ --showme:link
  -R/opt/mx/lib -R/usr/openmpi/ompi-1.5/lib -L/usr/openmpi/ompi-1.5/lib -lmpi -lopen-rte -lopen-pal -lnsl -lrt -lm -ldl -lsocket -lmpi_cxx
  </code></pre>
  
  <p>My compiler is g++.</p>