LNK2019 error (conversion program)

I'm getting the following error when trying to build this program (converts inches/pounds to centimeters/kilograms), and I'm not really sure what I'm doing wrong.

1>A5.obj : error LNK2019: unresolved external symbol "void __cdecl convert(int,int,double &,double &)" (?convert@@YAXHHAAN0@Z) referenced in function _main
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\x\Documents\Visual Studio 2008\Projects\A5\Debug\A5.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Users\x\Documents\Visual Studio 2008\Projects\A5\A5\Debug\BuildLog.htm"

From what I've seen online, it's an error when you're creating a win32 project...problem being, I'm not. (New project --> General --> Empty project, code-->C++ file) Here's the program:

#include <iostream> // Provides cout, etc.
using namespace std;

const int SENTINEL = -1; // Sentinel value used to end data entry
const double INCHES_TO_CM = 2.54; // Conversion factor for inches to centimeters
const double POUNDS_TO_KILOS = .454; // Conversion factor for pounds to kilograms

void explain_program();
// Tells the user what the program does

void decimal_format(ostream& os);
// Formats decimals nicely in output stream os

void read_inches_pounds(int& height_in_inches, int& weight_in_pounds);
// Postcondition: height_in_inches and weight_in_pounds have values from user at terminal

void convert(int height_in_inches, int weight_in_pounds, double& height_in_cms, double& weight_in_kilos);
// Precondition: height_in_inches and weight_in_pounds are knopwn positive values
// Postcondition: height_in_cms and weight_in_kilos have been calculated

void write_out(ostream& os, double height_in_cms, double weight_in_kilos);
// Precondition: height_in_cms and weight_in_kilos have values
// PostconditionL: These values are written to output stream os

int main()
{
int height_in_inches, // Height entered by user in inches
weight_in_pounds; // Weight entered by user in pounds

double height_in_cm, // Height in centimeters calculated by program
weight_in_kilos; // Weight in kilograms calculated by program

explain_program(); // Tells the user what the program does

decimal_format(cout); // Decimals are formatted nicely in cout

// Get height_in_inches and weight_in_pounds, or SENTINEL, from the user
read_inches_pounds(height_in_inches,weight_in_pounds);

// Process values, unless SENTINEL is entered
while (height_in_inches != SENTINEL)
{
// Convert the height to centimeters and the weight to kilograms
convert(height_in_inches, weight_in_pounds,
height_in_cm, weight_in_kilos);

// Display the converted values to the user
write_out(cout,height_in_cm, weight_in_kilos);

// Get the next set of values for height_in_inches and weight_in_pounds, or SENTINEL
read_inches_pounds(height_in_inches,weight_in_pounds);
}

return 0;
}

void explain_program()
{
cout << "This program converts a height in inches to centimeters and a weight in pounds to kilograms.";
cout << "Enter " << SENTINEL << " to end data entry.";
}

void decimal_format(ostream& os)
{
os.setf(ios::fixed);
os.setf(ios::showpoint);
os.precision(2);
}

void read_inches_pounds(int& height_in_inches, int& weight_in_pounds)
{
// Get height in inches or SENTINEL from user
cout << "Please enter a height in inches: ";
cin >> height_in_inches;

if (height_in_inches != SENTINEL)
{
// Get weight in pounds from user
cout << "Please enter a weight in pounds: ";
cin >> weight_in_pounds;
}
}

double convert(int height_in_inches, int weight_in_pounds)
{
double height_in_cm, // Local variable used to get height in centimeters
weight_in_kilos; // Local variable used to get weight in kilograms

// Convert the height from inches to centimeters
height_in_cm = height_in_inches/INCHES_TO_CM;

// Convert the weight from pounds to kilograms
weight_in_kilos = weight_in_pounds/POUNDS_TO_KILOS;

return height_in_cm, weight_in_kilos;
}

void write_out(ostream& os, double height_in_cm, double weight_in_kilos)
{
os << "The height in centimeters is " << height_in_cm << endl;
os << "The weight in kilograms is " << weight_in_kilos << endl;
}


Thanks
You didn't implement void convert(int height_in_inches, int weight_in_pounds, double& height_in_cms, double& weight_in_kilos); function.

And next time use code tags to make your source code more readable.
Topic archived. No new replies allowed.