User defined problem

//program to convert stone to lbs
#include<iostream>
int stonetolb(int);
int main()
{
using namespace std;
int stone;
cout<<"Enter the weight in stone:";
cin>>stone;
int pounds=stonetolb(stone);
cout<<stone<<"stone=";
cout<<pounds<<"pounds."<< endl;
return 0;
}

int stonetolbs(int sts)
{

return (14*sts);
}

my compiler keeps returning a code stating LNK2019 unresolved external symbol, i cant find anything wrong with the code personally, im sure its something simple im overlooking but i was just wondering if anyone could help me, ive defined both return values and the function itself and only included the std library in the first function, anyways, if you could let me know what exactly i did wrong instead of just fixing the code i'd greatly appreciate it, thanks guys!
Here's your function prototype:

int stonetolb(int);

And here's your function body:

1
2
3
4
5
int stonetolbs(int sts)
{

return (14*sts);
}


They don't match.
ive tried changing the prototype and the function to match eachother, but it keeps coming up with either the same message or C2062-type int unexpected, im not too sure what im either not defining in the prototype or if im using the function incorrectly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//program to convert stone to lbs
#include <iostream>

int stonetolb(int);

int main()
{
  using namespace std;
  int stone;
  cout << "Enter the weight in stone:";
  cin >> stone;
  int pounds = stonetolb(stone);
  cout << stone << " stone = ";
  cout << pounds << " pounds." << endl;

  return 0;
}

int stonetolb(int sts) // change name fix
{
  return (14*sts);
}
//program to convert stone to lbs
#include<iostream>
int stonetolb(int);
int main()
{
using namespace std;
int stoneolb;
cout << "Enter the weight in stone:";
cin >> stoneolb;
int pounds=stonetolb(stoneolb);
cout << stoneolb << "stone=";
cout << pounds << "pounds." << endl;
return 0;
}

int stoneolb(int stoneolb)

{
int pounds=14 * stoneolb;
return (pounds);
}

.............. ive tried changing the names to match the definitions and prototype etc, but its still coming up with the same LNK2019 error...............
Source1.obj : error LNK2019: unresolved external symbol "int __cdecl stonetolb(int)" (?stonetolb@@YAHH@Z) referenced in function _main
C:\Users\ryan\documents\visual studio 2010\Projects\Stone\Debug\Stone.exe : fatal error LNK1120: 1 unresolved externals
im wondering if i may have to put the definition before the main definition? But i didnt think it would make a difference so long as the definition for the prototype is found in the source code........
1
2
3
4
5
int stoneolb(int stoneolb)
{
int pounds=14 * stoneolb;
return (pounds);
}  //<--- You're missing three t's 
Topic archived. No new replies allowed.