i keep getting error messages when i try to build my program:

EmpType.obj : error LNK2001: unresolved external symbol "public: __thiscall SortedType::SortedType(void)" (??0SortedType@@QAE@XZ)

EmpType.obj : error LNK2001: unresolved external symbol "public: void __thiscall SortedType::ResetList(void)" (?ResetList@SortedType@@QAEXXZ)

I also get the same error for InsertItem,GetNextItem,DeleteItem,RetrieveItem,LengthIs

any help in understanding this would be a great help
here is my code:

//EmpType.cpp

#include <iostream>
#include <fstream>
#include <string.h>
#include "SortedType.h"
#include "ItemType.h"

ofstream outData;
enum CommandType {JOIN,QUIT,CHANGE,PROMOTE,DEMOTE,
PAYDAY,EMPLOYEES,UNEMPLOYED,DUMP,END};
void Join(SortedType&,SortedType&);
void GetCommand(CommandType&);
void Quit(SortedType&,SortedType&);
void Change(SortedType&);
void Unemployed(SortedType&);
void Dump(SortedType&,SortedType&);
void Employees(SortedType&);
void Payday(SortedType&,SortedType&);
void Demote(SortedType&);
void Promote(SortedType&);

void main()
{
    using namespace std;
	cout<<"Welcome to the Employee Program"<<endl;
	CommandType command;
	SortedType ourList,list2;
    
    outData.open("data.dat");
	GetCommand(command);
	while(command != END)
	{
		switch(command)
		{
			case JOIN: Join(ourList,list2);break;
			case QUIT: Quit(ourList,list2);break;
			case CHANGE: Change(ourList);break;
			case PROMOTE: Promote(ourList);break;
			case DEMOTE: Demote(ourList);break;
			case PAYDAY: Payday(ourList,list2);break;
			case EMPLOYEES: Employees(ourList);break;
			case UNEMPLOYED: Unemployed(list2);break;
			case DUMP: Dump(ourList,list2);break;
		}
		GetCommand(command);
	}

}

void GetCommand(CommandType& command)
{
    
	cout<<"EMPLOYEE MENU PROGRAM"<<endl;
	outData<<"EMPLOYEE MENU PROGRAM"<<endl;
	cout<<"Type in a Capitial letter from the choices below then press ENTER"<<endl;
	outData<<"Type in a Capitial letter from the choices below then press ENTER"<<endl;
	cout<<endl;
	outData<<endl;
	cout<<" J: A person joins a new company."<<endl;
	outData<<" J: A person joins a new company."<<endl;
	cout<<" Q: A person quits a company."<<endl;
	outData<<" Q: A person quits a company."<<endl;
	cout<<" C: A person quits their job and joins a different company."<<endl;
	outData<<" C: A person quits their job and joins a different company."<<endl;
	cout<<" P: A person is promoted."<<endl;
	outData<<" P: A person is promoted."<<endl;
	cout<<" D: A person is demoted."<<endl;
	outData<<" D: A person is demoted."<<endl;
	cout<<" M: payday."<<endl;
	outData<<" M: payday."<<endl;
	cout<<" E: Print list of employees in a company."<<endl;
	outData<<" E: Print list of employees in a company."<<endl;
	cout<<" U: Print list of unemployeed people."<<endl;
	outData<<" U: Print list of unemployeed people."<<endl;
	cout<<" A: Print both employee and unemployeed list."<<endl;
	outData<<" A: Print both employee and unemployeed list."<<endl;
	cout<<" X: END OF PROGRAM"<<endl;
	outData<<" X: END OF PROGRAM"<<endl;
	char letter;
	cin>>letter;
	cout<<endl;

	bool okay = false;
	while(!okay)
	{
		okay = true;
		switch(letter)
		{
		
			case 'J': command = JOIN; break;
			case 'Q': command = QUIT; break;
			case 'C': command = CHANGE; break;
			case 'P': command = PROMOTE;break;
			case 'D': command = DEMOTE;break;
			case 'M': command = PAYDAY; break;
			case 'E': command = EMPLOYEES; break;
			case 'U': command = UNEMPLOYED; break;
			case 'A': command = DUMP;break;
			case 'X': command = END;break;
			default: cout<<"Letter Entered was not one"
						 <<" of the choices above. ENTER"
						 <<" another Letter then press return: "<<endl;
					 outData<<"Letter Entered was not one"
						 <<" of the choices above. ENTER"
						 <<" another Letter then press return: "<<endl;
				     cin>>letter;
					 okay = false;
		}
	}
}

void Join(SortedType& ourList,SortedType& list2)
{
     bool check;
     string name,company;
     cout<<"Enter the employee's name"<<endl;
	 outData<<"Enter the employee's name"<<endl;
     cin>>name;
     cout<<"Enter the company"<<endl;
	 outData<<"Enter the company"<<endl;
     cin >> company;
     
     ItemType obj(name,company);
     int length = ourList.LengthIs();
	 
	 list2.RetrieveItem(obj,check);
	 if(check)
		 list2.DeleteItem(obj);
     
     for(int count = 0;count < length;count++)
     {
          ourList.GetNextItem(obj);
          ourList.DeleteItem(obj);
          obj.PromoteMe();
          ourList.InsertItem(obj);
     }
     
     ourList.InsertItem(obj);
     ourList.ResetList();
}

void Quit(SortedType& list2,SortedType& ourList)
{
     
	 cout<<"QUIT"<<endl;
     string name,company;
     cout<<"Enter the employee's name"<<endl;
	 outData<<"Enter the employee's name"<<endl;
     cin>>name;
     cout<<"Enter the company"<<endl;
	 outData<<"Enter the company"<<endl;
     cin >> company;
	
	 ItemType obj(name,company);
	 int length = ourList.LengthIs();
	 ourList.DeleteItem(obj);
	 list2.InsertItem(obj);
	
	 
	 for(int count = 0;count < length;count++)
     {
          ourList.GetNextItem(obj);
          obj.DemoteMe();
          ourList.InsertItem(obj);
     }
}

void Change(SortedType& ourList)
{
     cout<<"CHANGE"<<endl;
	 bool check = false;
	 string name,company;
	 while(!check)
	 {
		check = true;
		
		cout<<"Enter the employee's name"<<endl;
		outData<<"Enter the employee's name"<<endl;
		cin>>name;
		cout<<"Enter the company"<<endl;
		outData<<"Enter the company"<<endl;
		cin >> company;
     
		ItemType obj(name,company);
		int length = ourList.LengthIs();

		ourList.DeleteItem(obj);

		for(int count = 0;count < length;count++)
		{
          ourList.GetNextItem(obj);
          obj.PromoteMe();
          ourList.InsertItem(obj);
		}
		ourList.ResetList();
     }
	
	 int length = ourList.LengthIs();
	 ItemType obj(name,company);
     for(int count = 0;count < length;count++)
     {
          ourList.GetNextItem(obj);
          ourList.DeleteItem(obj);
          obj.PromoteMe();
          ourList.InsertItem(obj);
     }
     
     ourList.InsertItem(obj);
     ourList.ResetList();
}

void Promote(SortedType& ourList)
{
    string name,company;
	cout<<"PROMOTE"<<endl;
	cout<<"Enter the employee's name"<<endl;
	outData<<"Enter the employee's name"<<endl;
	cin>>name;
	cout<<"Enter the company"<<endl;
	outData<<"Enter the company"<<endl;
	cin >> company;
	
	ItemType obj(name,company);
	ItemType obj2(name,company);
	int length = ourList.LengthIs();
		
	
		ourList.DeleteItem(obj);
		ourList.GetNextItem(obj2);
		ourList.DeleteItem(obj2);
		ourList.InsertItem(obj2);
		ourList.InsertItem(obj);
		obj.PromoteMe();
		obj2.DemoteMe();
	
	/*else
	{
		cout<<"The person is already in the top position"
			<<"They can not be promoted"<<endl;
		outData<<"The person is already in the top position"
			<<"They can not be promoted"<<endl;
	}*/

}

void Demote(SortedType& ourList)
{
    string name,company;
	cout<<"DEMOTE"<<endl;
	cout<<"Enter the employee's name"<<endl;
	outData<<"Enter the employee's name"<<endl;
	cin>>name;
	cout<<"Enter the company"<<endl;
	outData<<"Enter the company"<<endl;
	cin >> company;
	
	ItemType obj(name,company);
	ItemType obj2(name,company);
	int length = ourList.LengthIs();
		
	//if(obj.rank < length)
	//{
		ourList.DeleteItem(obj);
		ourList.GetNextItem(obj2);
		ourList.DeleteItem(obj2);
		ourList.InsertItem(obj2);
		ourList.InsertItem(obj);
		obj.DemoteMe();
		obj2.PromoteMe();
	//}
	/*else
	{
		cout<<"The person is already in the bottom position"
			<<"They can not be demoted"<<endl;
		outData<<"The person is already in the bottom position"
			<<"They can not be demoted"<<endl;
	}*/
}
		
void Payday(SortedType& ourList, SortedType& list2)
{
    
	cout<<"PAYDAY"<<endl;
	outData<<"PAYDAY"<<endl;
	string name,company;
	ItemType obj(name,company);
	bool okay = false;
	int length = ourList.LengthIs();
	ourList.ResetList();
	for(int count = 0;count < length;count++)
	{

		ourList.GetNextItem(obj);
		obj.PayMe(okay);
	}
	
	list2.ResetList();
	int size = list2.LengthIs();
	okay = true;
	for(int k = 0;k < size;k++)
	{
		list2.GetNextItem(obj);
		obj.PayMe(okay);
	}
}
	
void Employees(SortedType& ourList)
{
	string name,company;
    ItemType obj(name,company); 
	cout<<"EMPLOYEES"<<endl;
	outData<<"EMPLOYEES"<<endl;
	cout<<"Enter the company's name:"<<endl;
	outData<<"Enter the company's name:"<<endl;
	cin>>company;
	ourList.ResetList();
	int length = ourList.LengthIs();
	for(int count = 0;count < length;count++)
	{
		ourList.GetNextItem(obj);
		obj.EPrint();
	}
	ourList.ResetList();
}

void Unemployed(SortedType& list2)
{
    string name,company;
	cout<<"UNEMPLOYED"<<endl;
	ItemType obj(name,company);;
	int length = list2.LengthIs();
	list2.ResetList();
	for(int count = 0;count < length;count++)
	{	
		list2.GetNextItem(obj);
		obj.UPrint();
	}
	list2.ResetList();
}

void Dump(SortedType& list2, SortedType& ourList)
{
	string name,company;
    ItemType obj(name,company);
	cout<<"DUMP"<<endl;
	int length = ourList.LengthIs();
	cout<<"EMPLOYEES"<<endl;
	for(int count = 0;count < length;count++)
	{	
		ourList.GetNextItem(obj);
		obj.EPrint();
	}
	
	int length2 = list2.LengthIs();
	cout<<"UNEMPLOYED"<<endl;
	for(int k = 0;k < length2;k++)
	{	
		list2.GetNextItem(obj);
		obj.UPrint();
		
	}
}

//ItemType.h

#ifndef ITEMTYPE
#define ITEMTYPE
#include <string>
#include <iostream>
#include <fstream>

const int MAX_ITEMS = 5;
using namespace std;
enum RelationType {LESS, EQUAL, GREATER};
class ItemType
{
      public:
			//constructor
		   ItemType(string myName,string myCompany);
		   
		   RelationType ComparedTo(ItemType);
		   //Purpose: compares objects
		   //Precondition: self and item have their key members initalized
		   //Postcondition:= LESS if the key of self is less then the key of item
						 //= GREATER if the key of self is greater then the key of item
						 //= EQUAL if the keys are equal
           void PromoteMe();           
				//Function: promotes the employee
				//Postcondition: Employee is promoted
		   void DemoteMe();
				//Function: demotes the employee
				//Postcondition: Employee is promoted
		   void PayMe(bool okay);
				//Postcondition: pays the employees
		   void EPrint();
		   void UPrint();

      private:
			  ofstream outData;
			  string company;
              string name;
              int rank;
              int total;
};

//constructor
ItemType :: ItemType(string myName, string myCompany)
{
        name = myName;
        company = myCompany;
        rank = 1;
        total = 0;
}

RelationType ItemType::ComparedTo(ItemType otherObj)
{
        if((company < otherObj.company)||(company == otherObj.company)
        &&(rank < otherObj.rank))
              return LESS;
        else if((company > otherObj.company)||(company == otherObj.company)
        && (rank > otherObj.rank))
              return GREATER;
        else
              return EQUAL;
}

void ItemType::PromoteMe()
{
     
    rank = rank+1;
}

void ItemType::DemoteMe()
{
	rank = rank-1;
}

void ItemType::PayMe(bool okay)
{
	if(!okay)
	total = total + rank * 1000;
	else
		total = total+ 50;
}

void ItemType::EPrint()
{
		cout<<"Name: "
			<<name<<endl;
		outData<<"Name: "
			<<name<<endl;
		cout<<"Company: "
			<<company<<endl;
		outData<<"Compnay: "
			<<company<<endl;
		cout<<"Rank: "
			<<rank<<endl;
		outData<<"Rank: "
			<<rank<<endl;
		cout<<"Total Pay: "
			<<total<<endl;
		outData<<"Total Pay: "
			   <<total<<endl;
		cout<<endl;
		outData<<endl;
}

void ItemType::UPrint()
{

		cout<<"Name: "
			<<name<<endl;
		outData<<"Name: "
			<<name<<endl;
		cout<<"Total Pay: "
			<<total<<endl;
		outData<<"Total Pay: "
			<<total<<endl;
}
#endif

//SortedType.h

#include "ItemType.h" 

class SortedType 
{
public:
   SortedType();
   bool IsFull() const;
   int LengthIs() const;
   void RetrieveItem(ItemType& item, bool& found);
   void InsertItem(ItemType item);
   void DeleteItem(ItemType item);
   void ResetList();
   void GetNextItem(ItemType& item);
 
private:
  int length;
  ItemType info[MAX_ITEMS];
  int currentPos;
};

Recommended Answers

All 2 Replies

any help in understanding this would be a great help

It means you are telling the compiler, "these functions will be available" -- to keep her quiet for compiling -- and then not telling the linker where to find them (or simply withholding them from her).

You are teasing the baby, and she's not happy. If you promise a function definition, provide one; otherwise, keep your mouth shut.

Or... define every function you prototype. Make good on your promises.

>i keep getting error messages when i try to build my program
Maybe you should try reading them instead of running here every time a build fails. And you still haven't bothered to post shorter code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.