I passed out a few hours ago working on this project..... as soon as I can get this class working, all I have to do is get its instances into arrays and bind it to a search/sort mechanisim, but alas... I am momentarily lost. Could someone please point out my goof?
-------------------Configuration: project1 - Win32 Debug--------------------
Linking...
project1.obj : error LNK2001: unresolved external symbol "public: void __thiscall Cereal::Set(char,int,int)" (?Set@Cereal@@QAEXDHH@Z)
project1.obj : error LNK2001: unresolved external symbol "public: __thiscall Cereal::Cereal(void)" (??0Cereal@@QAE@XZ)
Debug/project1.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
project1.exe - 3 error(s), 0 warning(s)
//--------------
.h file
class Cereal
{
public :
void Set ( char name , int protein , int calories ) ;
void Write () const;
Cereal (char init_name, int init_protein, int init_Calories ) ; // constructor
Cereal ()a ; // default constructor
private:
char name;
int protein, calories;
};
void Cereal::Write() const
{
cout<< name<<protein<<calories;
}
//--------------
.cpp file
void CerealEntry()
{
Cereal working;
char temp1; int temp2, temp3;
cout<<"Cereal Name:\n";
cin>>temp1;
cout<<"protein:\n";
cin>>temp2;
cout<<"calories:\n";
cin>>temp3;
working.Set(temp1,temp2,temp3);
working.Write;
}
-------------------Configuration: project1 - Win32 Debug--------------------
Linking...
project1.obj : error LNK2001: unresolved external symbol "public: void __thiscall Cereal::Set(char,int,int)" (?Set@Cereal@@QAEXDHH@Z)
project1.obj : error LNK2001: unresolved external symbol "public: __thiscall Cereal::Cereal(void)" (??0Cereal@@QAE@XZ)
Debug/project1.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
project1.exe - 3 error(s), 0 warning(s)
//--------------
.h file
class Cereal
{
public :
void Set ( char name , int protein , int calories ) ;
void Write () const;
Cereal (char init_name, int init_protein, int init_Calories ) ; // constructor
Cereal ()a ; // default constructor
private:
char name;
int protein, calories;
};
void Cereal::Write() const
{
cout<< name<<protein<<calories;
}
//--------------
.cpp file
void CerealEntry()
{
Cereal working;
char temp1; int temp2, temp3;
cout<<"Cereal Name:\n";
cin>>temp1;
cout<<"protein:\n";
cin>>temp2;
cout<<"calories:\n";
cin>>temp3;
working.Set(temp1,temp2,temp3);
working.Write;
}
