title: trying to call fortran subroutine in c++
body: <p>I have very limited knowledge of C++ and even less of fortran, I am currently trying to call a fortran subroutine from a c++ main. Following some examples I was able to come up with the following code to call the</p>
  
  <pre><code>subroutine fireballess(ear,ne,parames,ifl,photar,photer)
  </code></pre>
  
  <p>here is my C++ code:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  extern "C" void fireballess_( double *fear, int fne,double* fparames, int fifl, double *fphotar, double *fphoter);
  
  int main(int argc, char ** argv)
  {
      int ne,ifl;
      double *ear;
      double *parames;
  
      double *photar;
      double *photer;
  
  
      parames = new double[9];
  
  // parames=[4.3,0.23,0.5,0.5,1.5,1.,1000.,2.15,3.]
          parames[0]=4.3;
          parames[1]=0.23;
          parames[2]=0.5;
          parames[3]=0.5;
          parames[4]=1.5;
          parames[5]=1.;
          parames[6]=1000.;
          parames[7]=2.15;
          parames[8]=3.;
  
  ne = 2;
  
      ear = new double[ne];
   ear[0] = 0.;
   ear[1] = 20.;
   ear[2] = 40.;
   ifl=2;
  
      photar = new double[ne];
      photer = new double[ne];
  
      // Call a Fortran subroutine
      //subroutine_sum_(&amp;size,vec,&amp;sum);
      fireballess_(&amp;ear,ne,&amp;parames,ifl,&amp;photar,&amp;photer);
  
      cout &lt;&lt; "Calling a Fortran subroutine" &lt;&lt; endl;
      cout &lt;&lt; "===============================" &lt;&lt; endl;
  
  for (int i=0;i&lt;=ne;i++){
      cout &lt;&lt; "ear = " &lt;&lt;ear[i-1]&lt;&lt; " - "&lt;&lt;ear[i] &lt;&lt; endl;
      cout &lt;&lt; "photar = " &lt;&lt; photar[i] &lt;&lt; endl;
      cout &lt;&lt; "photer = " &lt;&lt; photer[i] &lt;&lt; endl &lt;&lt; endl;
  }
  
      delete[] ear;
      delete[] parames;
      delete[] photar;
      delete[] photer;
  }
  </code></pre>
  
  <p>however, when I try to compile I get the following error:</p>
  
  <pre><code>call_fortran.cpp: In function ‘int main(int, char**)’:
  call_fortran.cpp:45:53: error: cannot convert ‘double**’ to ‘double*’ for argument ‘1’ to ‘void fireballess_(double*, int, double*, int, double*, double)’
       fireballess_(&amp;ear,ne,&amp;parames,ifl,&amp;photar,photer);
  </code></pre>
  
  <p>which I do not understand, since the photer variable follows the very same path of the photar variable, that gives no errors instead.
  I hope someone with a better understanding of pointers than me can help me here.
  Thanks</p>