Unresolved External symbol

Apr 27, 2016 at 8:38am
why am I getting these two error codes:

error LNK2019: unresolved external symbol "double __cdecl getArea(double,double)" (?getArea@@YANNN@Z) referenced in function _main

error LNK1120: 1 unresolved externals

if you can please help me because this isn't the first program that I've run into a problem like this and I can't figure out what is wrong.
usually, I write my programs from scratch but this challenged required a pre-written code and I ahad to finish it but i keep getting thse two error codes please help me.

/*
Francisco Diaz
April 20, 2016
CIS-17A: C++ Programming
Chapter 6, Programming Challenge 2
*/

#include <iostream>
using namespace std;

// Write the prototypes for the getLength,
// getWidth, getArea, and displayData
// functions here.
double getLength();
double getWidth();
double getArea(double , double );
void displayData(double,double,double);


int main()
{
double length, // The rectangle's length
width, // The rectangle's width
area; // The rectangle's area

// Get the rectangle's length.
length = getLength();

// Get the rectangle's width.
width = getWidth();

// Get the rectangle's area.
area = getArea(length,width);

// Display the rectangle's data.
displayData(length, width, area);


system("PAUSE");
}

//***************************************************
// You must write the getLength, getWidth, getArea, *
// and displayData functions. *
//***************************************************


double getLength()
{
double length;

cout<<"What is the length of the rectangle: ";
cin>>length;
return length;
}

double getWidth()
{
double width;

cout<<"What is the width of the rectangle: ";
cin>>width;
return width;
}

double geatArea(double length,double width)
{
double area;
return length*width;

}

void displayData(double length,double width,double area)
{
cout << " For a rectangle whos\n lenght is: "<< length << endl;
cout << "Width is : " << width << endl;
cout << " The area is: "<<area<<endl;
}
Apr 27, 2016 at 8:47am
It's simple typo. You declare the function as
double getArea(double , double );
but implement it as
double geatArea (double length, double width)
Apr 27, 2016 at 8:55am
but don't i have to declare it that way in order to pass data into the function ?
Apr 27, 2016 at 9:00am
Yes, but your definition must match your declaration.
Apr 27, 2016 at 9:11am
how would i write it then because I'm lost and I've tried many things.

also then how come where i declare

void displayData(double,double,double)

then define

void displayData(double length,double width,double area)

it works just fine?
Apr 27, 2016 at 9:18am
never mind finally caught it just saw the A..... thank you
Topic archived. No new replies allowed.