Unable to compile simple Boost MPI example
<p>I was trying to use MPI with C++ Boost using the following code:</p>

<pre><code>#include &lt;boost/mpi/environment.hpp&gt;
#include &lt;boost/mpi/communicator.hpp&gt;
#include &lt;iostream&gt;
namespace mpi = boost::mpi;

int main()
{
  mpi::environment env;
  mpi::communicator world;
  std::cout &lt;&lt; "I am process " &lt;&lt; world.rank() &lt;&lt; "on " &lt;&lt; world.size() &lt;&lt; "." &lt;&lt; std::endl;
  return 0;
}
</code></pre>

<p>And I have boost mpi compiled and installed:</p>

<pre><code> ~ ls /usr/local/include/boost | grep mpi
mpi
mpi.hpp
~ ls /usr/local/lib | grep mpi   
libboost_mpi.a
libboost_mpi.so
libboost_mpi.so.1.62.0

 ~ ls /usr/local/lib | grep serialization                                                                                 
libboost_serialization.a
libboost_serialization.so
libboost_serialization.so.1.62.0
libboost_wserialization.a
libboost_wserialization.so
libboost_wserialization.so.1.62.0
</code></pre>

<p>Compiling using</p>

<pre><code>mpic++ -L/usr/local/lib -I/usr/local/include/boost/mpi -lboost_mpi-gcc-mt-1_35 -lboost_serialization MPIBoostBindingExample.cpp -o MPIBoostBindingExample
</code></pre>

<p>But still got errors saying:</p>

<pre><code>/tmp/ccKVwnKR.o: In function `main':
MPIBoostBindingExample.cpp:(.text+0x27): undefined reference to `boost::mpi::environment::environment(bool)'
MPIBoostBindingExample.cpp:(.text+0x33): undefined reference to `boost::mpi::communicator::communicator()'
MPIBoostBindingExample.cpp:(.text+0x3f): undefined reference to `boost::mpi::communicator::size() const'
MPIBoostBindingExample.cpp:(.text+0x4d): undefined reference to `boost::mpi::communicator::rank() const'
MPIBoostBindingExample.cpp:(.text+0xb8): undefined reference to `boost::mpi::environment::~environment()'
MPIBoostBindingExample.cpp:(.text+0xeb): undefined reference to `boost::mpi::environment::~environment()'
collect2: error: ld returned 1 exit status
</code></pre>

<p>Any help?</p>