Hey guys,

I'm getting this error:

1>GoblinRecruit.obj : error LNK2019: unresolved external symbol "public: void __thiscall Mob::set_data(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int)" (?set_data@Mob@@QAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHH@Z) referenced in function "public: __thiscall GoblinRecruit::GoblinRecruit(void)" (??0GoblinRecruit@@QAE@XZ)

When I try to run this section of code:

#include "Standard Libs.h"
#include "Ability.h"

class Mob
{
private:
	string name;
	int level;
	int given_xp;
	int given_gold;
	int attack;
	int attack_spd;
	int defence;
	int max_hp;
	int hp;
	int max_mp;
	int mp;
	int max_tp;
	int tp;

	vector<Ability> abilities;

public:
	void set_data(string name, int level, int given_xp, int given_gold, int attack, int defence, int max_hp, int max_mp, int max_tp, int attack_spd);
	void add_ability(Ability);

	virtual void print();
};

/////////////////////

#include "Standard Libs.h"
#include "Mob.h"

void Mob::print()
{
	cout << "Printing details for " << name << endl ;
	cout << "Name: " << name << endl ;
	cout << "Level: " << level << endl ;
	cout << "XP: " << given_xp << endl ;
	cout << "Gold: " << given_gold << endl ;
	cout << "--------------" << endl ;
	cout << "Attack: " << attack << endl ;
	cout << "Defence: " << defence << endl ;
	cout << "Max TP: " << max_tp << endl ;
	cout << "TP: " << tp << endl ;
	cout << "Max HP: " << max_hp << endl ;
	cout << "HP: " << hp << endl ;
	cout << "Max MP: " << max_mp << endl ; 
	cout << "MP: " << mp << endl ;
	cin.get();
}

/////////////

#include "Mob.h"

class Goblin : public Mob
{
public:
	Goblin();
};

///////////////////

#include "Goblin.h"

Goblin::Goblin() : Mob()
{

}

////////////////////

#include "Standard Libs.h"
#include "Goblin.h"

class GoblinRecruit : public Goblin
{
public:
	GoblinRecruit();
};

//////////////////////

#include "GoblinRecruit.h"

GoblinRecruit::GoblinRecruit() : Goblin()
{
	/* initialize random seed: */
	srand ( time(NULL) );

	set_data("Goblin Recruit", 1, 35, (rand() % 35 + 40), 20, 20, 75, 0, 50, 2);
}

//////////////////////

#include "Standard Libs.h"
#include "GoblinRecruit.h"

void InitializeEnvironment()
{
	GoblinRecruit gob();
}

Any clues on what I'm doing wrong?

There is no implementation for either of these methods:

void Mob::set_data(string name, int level, int given_xp, int given_gold, int attack, int defence, int max_hp, int max_mp, int max_tp, int attack_spd);
void Mob::add_ability(Ability);

lol. :)
Thanks

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.