Two errors occuring, I don't know what they mean,

This program compiles correctly but when I go to run it I get two errors. They are:
Error 1 error LNK2019: unresolved external symbol "double __cdecl kenteicEntergy(double,double)" (?kenteicEntergy@@YANNN@Z) referenced in function _main

Error 2 error LNK1120: 1 unresolved externals

If you can tell my how to fix and what the errors means exactly that would ne a great help thank you in advance.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 This program uses a function named kineticEntergy
that accepts mass and velocity as arguments. The 
function should then return teh amoun of kinetic 
entergy the object has. Demonstrate tge function 
call by calling it asking the user for input.
*/

#include <iostream>
#include <cmath>

using namespace std;

//Function Prototype.
double kenteicEntergy(double mass, double velocity);

int main()
{
	//Variables.
	double mass, velocity;
	char again;

	//Do while loop.
	do
	{
		//Cout statements asking for user input.
		cout << "Kenetic Energy Calculator." << endl;
		cout << "What is the objects mass in kg. ";
		cin >> mass;
		cout << "What is the velocity of the object. ";
		cin >> velocity;

		cout << "The kenetic energy is " << kenteicEntergy(mass, velocity) << " Joules.";

		//Aks if the user would like to try again.
		cout << "Would you like to try again? (y or n)";
		cin >> again;
	} while (again == 'y' || again == 'Y');

	system("pause");
	return 0;
}
/**************************************************************
*                keneticEnergy Function                       *
* This function will calculate the kenetic energy. This       *
* function accepts an pbjects mass and velocity as arguments. *
* The function will then return the amount of kenetic energy  *
*the object has.                                              *
***************************************************************/

double keneticEntergy(double mass, double velocity)
{
	double kE;
	kE = 1.0 / 2.0 * mass *pow (velocity, 2);

	return kE;
}
closed account (2UD8vCM9)
Your prototype is called kenteicEntergy but your function at the bottom is called keneticEntergy. Try renaming the function at the bottom so the names match.
Only one error. From the linker. The linker sees that the main() calls function double kenteicEntergy(double, double), but there is no implementation for that function anywhere.
Thank you. That is two programs that I have had in a row that a typo kept me from completing without help. I guess sometimes you just need fresh to see what you are missing.
Topic archived. No new replies allowed.