title: Errors while compiling MPI
body: <p>I am trying to compile a code in C++ using code from : <a href="https://stackoverflow.com/questions/5953979/sending-and-receiving-array-using-mpi-part-2">https://stackoverflow.com/questions/5953979/sending-and-receiving-array-using-mpi-part-2</a>. </p>
  
  <p>I use the following command to compile: <code>mpiicpc -o &lt;filename&gt; xxxx.cc -lmpi</code></p>
  
  <p>After I compile, all my errors seem to refer to the two functions i have defined in my source code to print output values and do the MPI Isend and MPI Irecv. Specifically, I get two types of errors</p>
  
  <ol>
  <li>Error: Identifier "variable" is undefined</li>
  <li>Error: Too few arguments in function call: <code>MPI_Isend/MPI_Irecv</code> and <code>MPI Waitall();</code>
  Finally, it exists with this message: compilation aborted for xxxx.cc (code 2). </li>
  </ol>
  
  <p>Could you please point to what I must be doing wrong while defining the variables?</p>
  
  <p>Here is an excerpt of my source code (The code in its entirety is available at <a href="https://stackoverflow.com/questions/5953979/sending-and-receiving-array-using-mpi-part-2">https://stackoverflow.com/questions/5953979/sending-and-receiving-array-using-mpi-part-2</a>):</p>
  
  <pre><code>int main (int argc, char *argv[])
  {
  int my_rank;
  int p;
  int source; 
  int dest;
  int tag = 0;
  
  //Allocating Memory
  double *A = new double[Rows*sizeof(double)];
  double *B = new double[Rows*sizeof(double)];
  ....
  ....
  ....
  
  //MPI Commands
  MPI_Status status;
  MPI_Init (&amp;argc, &amp;argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &amp;my_rank);
  MPI_Comm_size(MPI_COMM_WORLD, &amp;p);
  
  //For number of beats
  
  for (ibeat=0;ibeat&lt;beats;ibeat++)
  {
      for (i=0; i&lt;Cols/2; i++)
      {
          for (y=0; y&lt;Rows/2; y++)
          {
              if (my_rank == 0)
                  if (i &lt; 48)
                      if (y&lt;48)
                         V[i][y] = 0;
  
              if (my_rank ==
                .....
                  ....
                    ....        
          }
      }
  
      //Load the Array with the edge values
      for (r=0; r&lt;Rows/2; y++)
      {
          if ((my_rank == 0) || (my_rank == 1))
          {
              A[r] = V[r][48];
              BB[r] = V[r][48];
          }
  
          if ((my_rank
              ...
              ...
      }
  
      prttofile ();
      outputpass ();
      ibeat = ibeat+1;
   }
  
   MPI_Finalize ();
  }
  
  
  void prttofile ()
  {
  for (i = 0; i&lt;Cols/2; i++)
    {
      for (y = 0; y&lt;Rows/2; y++)
      {
          if (my_rank == 0)
             fout &lt;&lt; V[i][y] &lt;&lt; " " ;
          ....
             .... 
      }
    }
  
  if (my_rank == 0)
      fout &lt;&lt; endl;
   ....
  }
  
  
  void outputpass ()
  {
  int test = 2;
  if ((my_rank%test) == 0)
  {
      MPI_Isend(C, Rows, MPI_DOUBLE, my_rank+1, MPI_COMM_WORLD); //Non blocking Send
      MPI_Irecv(CC, Rows, MPI_DOUBLE, my_rank+1, MPI_COMM_WORLD, &amp;status); //Non Blocking Recv
  }
  else if ((my_rank%test) == 1)
  ....
  ....
  
  MPI_Waitall ();
  }
  </code></pre>