title: Compile c++ code using Magick++ and openMPI
body: <p>I'm trying to compile my C++ code using <code>Magick++</code> library to manipulate images in a distributed way using <code>openMPI</code> and I get some errors when I try to compile it.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include "mpi.h"
  #include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;Magick++.h&gt;
  using namespace std; 
  using namespace Magick; 
  
  int main(int argc, char **argv){
  
  int rank, numtask;
  
  InitializeMagick(*argv);
  
  Image image;
  try { 
      // Read a file into image object 
      image.read( "test_image.jpg" );
      image.type( GrayscaleType );
      Blob blob; 
      image.magick( "JPEG" ); // Set JPEG output format 
      image.write( &amp;blob );
  
  } 
  catch( Exception &amp;error_ ){ 
      cout &lt;&lt; "Caught exception: " &lt;&lt; error_.what() &lt;&lt; endl; 
      return 1; 
   } 
  
  //Now in the "distributed enviroment" I just print an hello world to test it. 
  MPI_Init(&amp;argc,&amp;argv);
  
  MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
  MPI_Comm_size(MPI_COMM_WORLD, &amp;numtask);
  
  cout&lt;&lt;"HelloWorld\n";
  
  MPI_Finalize();
  </code></pre>
  
  <p>}</p>
  
  <p>this is the command that I type on the shell</p>
  
  <pre><code>mpiCC openmpi_project.cc -o openmpi_project
  </code></pre>
  
  <p>and this is the output of the shell</p>
  
  <blockquote>
    <p>openmpi_project.cc:(.text+0x1d): undefined reference to
    "Magick::InitializeMagick(char const*)"</p>
    
    <p>openmpi_project.cc:(.text+0x29): undefined reference to
    "Magick::Image::Image()"</p>
    
    <p>openmpi_project.cc:(.text+0x5d): undefined reference to
    "Magick::Image::read(std::string const&amp;)"</p>
    
    <p>openmpi_project.cc:(.text+0x86): undefined reference to
    "Magick::Image::type(MagickCore::ImageType)"</p>
    
    <p>openmpi_project.cc:(.text+0x92): rundefined reference to
    "Magick::Blob::Blob()"</p>
    
    <p>openmpi_project.cc:(.text+0xc6): undefined reference to
    "Magick::Image::magick(std::string const&amp;)"</p>
    
    <p>openmpi_project.cc:(.text+0xf1): undefined reference to
    "Magick::Image::write(Magick::Blob*)"</p>
    
    <p>openmpi_project.cc:(.text+0xfd): undefined reference to
    "Magick::Blob::~Blob()"</p>
    
    <p>openmpi_project.cc:(.text+0x158): undefined reference to
    "Magick::Image::~Image()"</p>
    
    <p>openmpi_project.cc:(.text+0x1d3): undefined reference to
    "Magick::Blob::~Blob()"</p>
    
    <p>openmpi_project.cc:(.text+0x261): undefined reference to
    "Magick::Image::~Image()"</p>
    
    <p>/tmp/ccqFzUdy.o:(.gcc_except_table+0x58): undefined reference to
    "typeinfo for Magick::Exception"</p>
  </blockquote>