0

I keep getting these error messages:

"error LNK2019: unresolved external symbol "void __cdecl MainPhase(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > *)" (?MainPhase@@YAXPAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) referenced in function _main"

"error LNK2019: unresolved external symbol "void __cdecl DrawForKaiba(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > *)" (?DrawForKaiba@@YAXPAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) referenced in function _main"

and

" error LNK2019: unresolved external symbol "void __cdecl Beginning(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > *)" (?Beginning@@YAXPAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) referenced in function _main"

the code is below

#include <stdlib.h>
#include <windows.h>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

//srand(time(0));

vector<string> Hand;
vector<string>::iterator it;

vector<string> Field;
vector<string>::iterator Ft;

void Beginning(vector<string> *Hand);
void DrawForKaiba(vector<string> *Hand);
void MainPhase(vector<string> *Hand);
void BattlePhase();
int MainHand;
int CardSlot;
int Decision;


int main()
{
	srand(time(0));

Beginning(&Hand);
DrawForKaiba(&Hand);
MainPhase(&Hand);
BattlePhase();


cout<< "\n"<<"GAME OVER"<<endl;

return 0;
} 



void Beginning(vector<string> &Hand)
{
for (int i=1; i<6; i++)
	{
		DrawForKaiba(&Hand);
	}
}


void DrawForKaiba(vector<string> &Hand)
{

int DrawKaiba = rand() % 40 + 1;
cout<<"Random number is: "<<DrawKaiba<<" "<<endl;

switch (DrawKaiba)
{
case 1:
case 2:
case 3:
	cout<<"BLUE EYES WHITE DRAGON"<<endl;
	Hand.push_back("BLUE EYES WHITE DRAGON");
	break;
case 4:
	cout<<"Vorse Raider"<<endl;
	Hand.push_back("VORSE RAIDER");
	break;
case 5:
	cout<<"BLADE KNIGHT"<<endl;
	Hand.push_back("BLADE KNIGHT");
	break;
case 6:
	cout<<"KAISER SEA HORSE"<<endl;
	Hand.push_back("KAISER SEA HORSE");
	break;
case 7:
	cout<<"LORD OF DRAGONS"<<endl;
	Hand.push_back("LORD OF DRAGONS");
	break;
case 8:
case 9:
case 10:
	cout<<"THUNDER DRAGON"<<endl;
	Hand.push_back("THUNDER DRAGON");
	break;
case 11:
	cout<<"CYBER JAR"<<endl;
	Hand.push_back("CYBER JAR");
	break;
case 12:
	cout<<"SPEAR DRAGON"<<endl;
	Hand.push_back("SPEAR DRAGON");
	break;
case 13:
	cout<<"TWIN HEADED BEHEMOTH"<<endl;
	Hand.push_back("TWIN HEADED BEHEMOTH");
	break;
case 14:
	cout<<"X CANNON HEAD"<<endl;
	Hand.push_back("X CANNON HEAD");
	break;
case 15:
	cout<<"Y DRAGON HEAD"<<endl;
	Hand.push_back("Y DRAGON HEAD");
	break;
case 16:
	cout<<"Z HEAD TANK"<<endl;
	Hand.push_back("Z HEAD TANK");
	break;
case 17:
	cout<<"VAMPIRE LORD"<<endl;
	Hand.push_back("VAMPIRE LORD");
	break;
case 18:
	cout<<"SPIRIT RYU"<<endl;
	Hand.push_back("SPIRIT RYU");
	break;
case 19:
	cout<<"POSSESSED DARK SOUL"<<endl;
	Hand.push_back("POSSESSED DARK SOUL");
	break;
case 20:
	cout<<"LA JINN THE MYSTICAL GENIE OF THE LAMP"<<endl;
	Hand.push_back("LA JINN THE MYSTICAL GENIE OF THE LAMP");
	break;
case 21:
	cout<<"DIFFERENT DIMENSION DRAGON"<<endl;
	Hand.push_back("DIFFERENT DIMENSION DRAGON");
	break;
case 22:
case 23:
case 24:
	cout<<"GIANT GERM"<<endl;
	Hand.push_back("GIANT GERM");
	break;
case 25:
	cout<<"SHRINK"<<endl;
	Hand.push_back("SHRINK");
	break;
case 26:
	cout<<"HEAVY STORM"<<endl;
	Hand.push_back("HEAVY STORM");
	break;
case 27:
	cout<<"MONSTER REBORN"<<endl;
	Hand.push_back("MONSTER REBORN");
	break;
case 28:
	cout<<"POLYMERIZATION"<<endl;
	Hand.push_back("POLYMERIZATION");
	break;
case 29:
	cout<<"POT OF GREED"<<endl;
	Hand.push_back("POT OF GREED");
	break;
case 30:
	cout<<"FLUTE OF SUMMONING DRAGON"<<endl;
	Hand.push_back("FLUTE OF SUMMONING DRAGON");
	break;
case 31:
	cout<<"COST DOWN"<<endl;
	Hand.push_back("COST DOWN");
	break;
case 32:
	cout<<"ENEMY CONTROLLER"<<endl;
	Hand.push_back("ENEMY CONTROLLER");
	break;
case 33:
	cout<<"SILENT DOOM"<<endl;
	Hand.push_back("SILENT DOOM");
	break;
case 34:
	cout<<"SOUL EXCHANGE"<<endl;
	Hand.push_back("SOUL EXCHANGE");
	break;
case 35:
	cout<<"CRUSH CARD"<<endl;
	Hand.push_back("CRUSH CARD");
	break;
case 36:
	cout<<"VIRUS CANNON"<<endl;
	Hand.push_back("VIRUS CANNON");
	break;
case 37:
	cout<<"RING OF DESTRUCTION"<<endl;
	Hand.push_back("RING OF DESTRUCTION");
	break;
case 38:
	cout<<"DRAGON'S RAGE"<<endl;
	Hand.push_back("DRAGON'S RAGE");
	break;
case 39:
	cout<<"FIEND'S SANCTUARY"<<endl;
	Hand.push_back("FIEND'S SANCTUARY");
	break;
case 40:
	cout<<"INTERDIMENSIONAL MATTER TRANSPORTER"<<endl;
	Hand.push_back("INTERDIMENSIONAL MATTER TRANSPORTER");
	break;


}

}//DrawforKaiba




void MainPhase(vector<string> &Hand)
{
	while(1)//so the while loop NEVER breaks unless you have a 'break' later on
	{
	cout<<"Would you like to end the Main Phase? (Yes-'1'  No-'0')"<<endl;
	cin>>Decision;
		if (Decision==1)
		{
			break;
		}

		cout<<"Your hand contains: "<<endl;
		//for (it=Hand.begin(); it<Hand.end(); it++)
		//{
		//	cout<<"   qw "<<*it<<endl;
		//}
		cout<<"Which card in your hand do you wish to play? (if none, press '0')"<<endl;
		cin>>MainHand;
		cout<<"Where do you want to place this card? "<<endl;
		cin>>CardSlot;
		switch (CardSlot)
			{
			case 1:
				cout<<"The card is played in the slot 1"<<endl;
			case 2:
				cout<<"The card is played in the slot 2"<<endl;
			case 3:
				cout<<"The card is played in the slot 3"<<endl;
			case 4:
				cout<<"The card is played in the slot 4"<<endl;
			case 5:
				cout<<"The card is played in the slot 5"<<endl;
			case 6:
				cout<<"The card is played in the slot 6"<<endl;
			case 7:
				cout<<"The card is played in the slot 7"<<endl;
			case 8:
				cout<<"The card is played in the slot 8"<<endl;
			case 9:
				cout<<"The card is played in the slot 9"<<endl;
			case 10:
				cout<<"The card is played in the slot 10"<<endl;
			case 11:
				cout<<"The card is discarded to the Graveyard"<<endl;
			}


    }// end of while(1)

}



void BattlePhase()
{
	while(1)//so the while loop NEVER breaks unless you have a 'break' later on
	{
	cout<<"Would you like to end the Battle Phase? (Yes-'1'  No-'0')"<<endl;
	cin>>Decision;
		if (Decision==1)
		{
			break;
		}

//		cout<<"Your Field contains: "<<endl;
//		for (Ft=Field.begin(); Ft<Field.end();Ft++)
//		{
//			cout<<" "<<*Ft;
//		}
	//	cout<<"Which card on your field do you wish to play? (if none, press '0')"
	//	cin>>Ft;
	//	cout<<"My "<<Field[Ft]<<" ATTACKS! "<<endl;
    }// end of while(1)

}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by sfuo
0

Your function prototypes are different than your function definitions. In the prototypes you are expecting a pointer to a vector where in the definitions you are expecting the reference of that object.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.