title: Undefined error
body: <p>I have gotten an error that says undefined reference to </p>
  
  <pre><code> `slope(double*, double*, double*, double*, double*, int, double)', 
  </code></pre>
  
  <p>but I have defined slope in my program. So I do not get what it is saying its undefined can someone please explain what is wrong with this code thank you.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  #include &lt;cmath&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace std;
  
  void read ();
  void slope(double[],double[],double[],double[],double[],int,double);
  void write(double[],double[],double[],double[],double[],double);
  double temp, R1, R2, R3, R4,rsq;
  
  int main ()
  {
  
      int indx=0;
      read();
      return 0;   
  }
  
  void read()
  {
  
      ifstream indata("c:\\doc1\\temperaturedata.txt");
      int indx=0;
      if(indata == NULL)
      {
          cout&lt;&lt; "There is no file go get it from the CD"&lt;&lt; endl;
          return;
      }
      const int columns = 5;
      const int rows = 11;
  
      double Ihatearray[rows][columns];
      string temparature;
      getline(indata, temparature);
      for(int i = 0; i &lt; rows; ++i)
      {
          for (int j = 0; j &lt; columns; ++j)
              {
                  cout &lt;&lt; "\t" &lt;&lt; flush;
                  indata &gt;&gt; Ihatearray[i][j];
                  cout.setf(ios::fixed);
                  cout &lt;&lt; setprecision(2) &lt;&lt; Ihatearray[i][j] &lt;&lt;flush;
              }
              cout &lt;&lt; endl;
  
      }
      indata.close();
      slope(&amp;temp, &amp;R1, &amp;R2, &amp;R3, &amp;R4,indx,rsq);
  }
  void slope(double x[], double y[], double&amp; m, double&amp; b, int n,double r)
  {
      int i;
  double xsum = 0., ysum = 0., xave, yave, x2sum = 0., y2sum = 0.,xysum =0.;
  
  for(int i = 0; i &lt; n; i++)
  {
      xsum  += x[i];
      ysum  += y[i];
      x2sum += x[i] * x[i];
      y2sum += y[i] * y[i];
      xysum += x[i] * y[i];
  }
  
  xave=xsum/n;
  yave=ysum/n;
  
  m=(xysum-yave*xsum)/(x2sum-xave*xsum);
  b=yave-m*xave;
  r=(xysum-n*xave*yave)/(sqrt(x2sum-n*xave*xave)*sqrt(y2sum-n*yave*yave));
  
  write (&amp;temp, &amp;R1, &amp;R2, &amp;R3, &amp;R4,rsq);
  
  }
  void write (double temp [], double R1[], double R2[], double R3[],double R4[],double
              rsq)
  {
      //Where I will print out a table of the results.
  }
  </code></pre>