undefined reference to `convert(int, int&, int&)'
Nov 5, 2013 at 7:40pm UTC
I have no idea what I'm doing wrong, it looks like it's all set up right, but Clang gives me undefined reference to `convert(int, int&, int&)'. And even after that's fixed it wont pass anything.
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
#include <iostream>
#include <iomanip>
using namespace std;
const double CM_PER_INCH = 2.54; // othere are 2.54 cm in one inch
const int INCH_PER_FOOT = 12; // there are 12 inches in one foot
int getHeight();
void convert(int , int &, int &);
void displayResult(int , int , int );
int main()
{
int myHeight;
int feet;
int intInch;
getHeight();
convert(myHeight, intInch, feet);
displayResult(myHeight, feet, intInch);
return 0;
}
int getHeight()
{
int height;
cout << "Enter your height in centimeter: " ;
cin >> height;
return height;
}
void convert(int cm, int feet, int inches)
{
int totalInch = static_cast <int >(cm / CM_PER_INCH + 0.5);
feet = totalInch / INCH_PER_FOOT;
inches = totalInch % INCH_PER_FOOT;
}
void displayResult(int cm, int feet, int inches)
{
cout << fixed << showpoint << setprecision(1);
cout << endl << cm << " centimeter is equivalent to:\n"
<< feet << " feet and "
<< inches << " inch\n" ;
}
Nov 5, 2013 at 8:00pm UTC
Your formal parameter lists for convert() on lines 10 and 38 do not match.
Topic archived. No new replies allowed.