syntax - C++ linked error ld returned 1 exit status -


i trying compile keep getting error, see mistake is?

c:\users\brian'~1\appdata\local\temp\cc2feaaa.o(.text+0x368) in function `main':

[linker error] undefined reference `secant(double, double, double, double, double, double, double, double, double&, int&, double)

c:\users\brian'~1\appdata\local\temp\cc2feaaa.o(.text+0x368) ld returned 1 exit status

using namespace std; #include<iostream> #include<cmath> #include<iomanip> #include<fstream> // declaration of functions used void writetable (double, double, double, double); void secant(double, double, double, double, double, double, double, double, double&, int&, double); void writedata (double, double, double); double fx( double, double, double, double, double, double, double);  const double tol=0.0001;    // tolerance convergence const int max_iter=50;      // maximum iterations allowed // main program int main() {     int iteration;          // number of iterations      double  kr, uc, q, b, radians;      double x0, x1;          // starting values x     double root;           // root found secant method const double pi = 4.0*atan(1.0); ifstream datain ("shuttle.txt"); ofstream dataout ("results.txt"); datain >> kr >> uc >> q >> b; x0= 1000; x1 = 200; (double velocity = 16000; velocity <= 17500; velocity += 500) {         (double angle = 10; angle <= 70; angle += 15)         {                   radians= angle * pi/180  ;                   cout << velocity << endl;                   cout << radians << endl;                   cout << angle << endl;                   secant (radians, velocity, kr, uc, q, b, x0, x1, root, iteration, angle);           }  }   writetable(kr, uc, q, b);   system("pause"); }  // definition of function "secant" // receives a, b, c, d , x0 values main program // returns root , iterations required void secant(double radians, double velocity, double kr, double uc, double q, double b, double x0, double x1, double angle, double& root, int& iteration) {     double xnminus1, xnplus1, xn; // local variables     iteration=0;                  // initialize iterations     xnminus1=x0;     xn=x1;         {        ++iteration;        xnplus1 = xn - fx(radians, velocity, kr, uc, q, b, xn)*(xn-xnminus1)/                                   (fx(radians, velocity, kr, uc, q, b, xn)-fx(radians, velocity, kr, uc, q, b, xnminus1));        cout<<"x"<<iteration+1<<" = "<<xnplus1<<endl;        xnminus1 = xn;        xn=xnplus1;     }       while ((fabs(fx(radians, velocity, kr, uc, q, b, xnplus1)) >= tol )&& (iteration < max_iter));     root=xnplus1;        cout<<"\nthe root = "<<root<<endl;     cout<<"the number of iterations = "<<iteration<<endl;     cout<<"the value of f(x) @ root = "<<fx(radians, velocity, kr, uc, q, b, root)<<endl<<endl;      if(root <1000) cout << "safe"<<endl<<endl; else cout <<"unsafe"<<endl<<endl;     writedata(angle, velocity, root); } // defines "fx"  double fx(double radians,double velocity, double kr, double uc, double q, double b, double ts) {      return kr * pow(ts,4.0) + uc * ts - q - pow((velocity / b), 2.0) * sin(radians);   } void writetable(double kr, double uc, double q, double b) {      cout <<endl << "input parameters:" <<endl;      cout<< "kr(1/k^2)=" << kr << endl << "uc(1/k)=" << uc <<endl << "q(unitless)=" << q << endl << "b(mph)=" << b<< endl; //not done part yet      cout << "  angle..............velocity...........surface temp..............safe..........";      cout << "  degs...............mph................kelvin.....................?............";      cout << "--------------------------------------------------------------------------------";         }  void writedata (double angle, double velocity, double root)  {   } 

the declaration of function secant

void secant(double, double, double, double, double, double, double, double, double&, int&, double); 

differs signature of actual implementation:

void secant(double radians, double velocity, double kr, double uc, double q, double b, double x0, double x1, double angle, double& root, int& iteration) {     ...  } 

the linker trying find implementation declared parameter list, doesn't find it.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -