c++ - Undefined reference to '(all my functions)' -
i'm getting these errors:
undefined reference 'getlength()'
undefined reference 'getwidth()'
undefined reference 'getarea(double, double)'
undefined reference 'displaydata(double, double, double)'
here's code:
#include <iostream> using namespace std; double getlength(); double getwidth(); double getarea(double,double); void displaydata(double,double,double); int main() { double length; double width; double area; length = getlength(); width = getwidth(); area = getarea(length,width); displaydata(length,width,area); return 0; } //getlength function double getlength(); { double length; cout << "length: "; cin >> length; return length; } //getwidth function double getwidth(); { double width; cout << "width: "; cin >> width; return width; } //getarea function double getarea(double lenght, double width); { return length*width; } //displaydata function void displaydata(double length, double width, double area); { cout << "\nrectangle data\n" << "---------------\n" << "length: " << length << endl << "width: " << width << endl << "area: " << area << endl; }
other missing parenthesis (}) @ end of main, shouldn't have semicolons in function definitions:
double getlength(); <-- should not there { .... }
Comments
Post a Comment