I seem to be getting this error:
Converter.obj : error LNK2019: unresolved external symbol "public: double __thiscall convert::MPH2KM(double)" (?MPH2KM@convert@@QAENN@Z) referenced in function _main
fatal error LNK1120: 1 unresolved externals
Converter.cpp
Code:
#include "stdafx.h"
#include <iostream>
#include "m4th2.h"
using std::cout;
using std::cin;
int main()
{
//Variables declared, one for the choice made by the user
//the other for the value entered for converting.
int choice;
double mph;
//double pounds;
//double inches;
convert convert2;
cout << "This Is A Converter\n";
cout << "Menu:\n" << "1 - MPH To KM\n" << "2 - Pounds To Kilos\n" << "3 - Inches To CM\n";
cout << "Please Enter A Choice:\n";
cin >> choice;
if (choice == 1)
{
cout << "Please Enter The Amount Of MPH To Convert To KM:\n";
cin >> mph;
cout << convert2.MPH2KM(mph);
}
else if (choice == 2)
{
cout << "Please Enter The Amount of Pounds To Convert To Kilos\n";
}
else
{
cout << "Please Enter The Amount of Inches To Convert To CM\n";
}
return 0;
}
m4th.cpp
Code:
#include "stdafx.h"
#include "m4th2.h"
double MPH2KM(double mph)
{
double km;
double mphconv = 1;
km = mph * 1.609;
return km;
}
m4th.h
Code:
#include <iostream>
class convert
{
public:
double MPH2KM(double mph);
double P2K(double p);
double I2C(double i);
};
Can anyone help?