I am getting errors that I have never seen before in a program that uses class englishweight with float number and float eng_weight to output number*englishweight and other things in the EW_driver.cpp. Here is what my build log looks like:
------ Build started: Project: assignment_2, Configuration: Debug Win32 ------1>Compiling...1>EW_Driver.cpp1>Linking...1>EW_Driver.obj : error LNK2019: unresolved external symbol "public: float __thiscall englishweight::getnumber(void)" (?getnumber@englishweight@@QAEMXZ) referenced in function _main1>EW_Driver.obj : error LNK2019: unresolved external symbol "public: float __thiscall englishweight::getweight(void)" (?getweight@englishweight@@QAEMXZ) referenced in function _main1>EW_Driver.obj : error LNK2019: unresolved external symbol "public: void __thiscall englishweight::def_weight(float)" (?def_weight@englishweight@@QAEXM@Z) referenced in function _main1>EW_Driver.obj : error LNK2019: unresolved external symbol "public: void __thiscall englishweight::def_number(float)" (?def_number@englishweight@@QAEXM@Z) referenced in function _main1>EW_Driver.obj : error LNK2019: unresolved external symbol "public: __thiscall englishweight::englishweight(void)" (??0englishweight@@QAE@XZ) referenced in function _main1>C:\Documents and Settings\Computer stuff man\Desktop\test progams\assignment_2\Debug\assignment_2.exe : fatal error LNK1120: 5 unresolved externals1>Build log was saved at "file://c:\Documents and Settings\Computer stuff man\Desktop\test progams\assignment_2\assignment_2\Debug\BuildLog.htm"1>assignment_2 - 6 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I don't know why these are popping up and I desperately need help. Here is my current source code:
Englishweight.h :
class englishweight{
private:float number;
float eng_weight; //not englishweight because IDE thinks it is constructor
public:
englishweight();
float getnumber();
float getweight();
void def_number(float defn);
void def_weight(float defw);
};
Englishweight_def.h
class englishweight::englishweight()
{
number=0;
eng_weight=0;
}
class englishwieght::getnumber()
{
return number;
}
class englishweight::getweight()
{
return eng_weight;
}
class englishweight::def_number(float defn)
{
number=defn;
}
class englishweight::def_wieght(float defw)
{
eng_weight=defw;
}
$EW_driver.cpp :
#include<iostream>
#include<fstream>
#include"Englishweight.h"
using namespace std;
int main()
{
float defw=0; //define float eng_weight
defn=0; //define number
float defo=0; //define ounces(part of defw seen later)
class englishweight testing;
cout<<"Welcome to Englishweight V 1.0!";
system("pause");
system("cls");
cout<<"Please input a weight-pounds then ounces."<<endl<<"Pounds: ";
cin>>defw;
cout<<endl<<"Ounces: ";
cin>>defo;
system("cls");
cout<<"Now enter a number."<<endl<<"number: ";
cin>>defn;
if(defo=!0)
{
defw=(defw/16.0); //convert pounds to ounces
defw=(defw+defo); //add the converted weight to the ounces to get the final eng_weight
}
testing.def_number(defn); //use def_number and def_weight functions to define eng_weight
numbertesting.def_weight(defw);
cout<<endl<<"Englishweight + Englishweight is: "
<<( (testing.getweight() )*2);
cout<<endl<<"Englishweight - Englishweight is: "<<"0";
//will always be 0 so no need to use processing power
cout<<endl<<"Englishweight / Englishweight is: "<<"1";
//will always be 1 so no need to use processing powercout<<endl<<"Englishweight * number is: "<<( (testing.getweight()) * (testing.getnumber()) );
cout<<endl<<"Number * Englishweight is: "<<( (testing.getnumber()) * (testing.getweight()) );
cout<<endl<<"Englishweight / number is: "<<( (testing.getweight()) / (testing.getnumber()) );
system("pause");
return 0;
}
Thank you for any help, it would be greatly appreciated as I am really trying to get this to work quickly.