Apple Mach-O Linker (ld) Error? what..?

Hi, im getting a really weird error right now, and im unsure how to fix it. Here is my code atm:

#include <iostream>
#include "All.h" //all stats etc.
#include <cmath>
using namespace std;
void ChooseRace();
void ChooseClass();
void ChooseLevel();
void Fighting();
void HumanFighterStats(); //lvl 1-15
void EnemyHumanFighterStats(); //lvl 1-15
void HumanSwordAndShieldStats(); //lvl 15-35
void EnemyHumanSwordAndShieldStats(); //lvl 15-35
void HumanPaladinStats(); //lvl 35-50
void EnemyHumanPaladinStats(); //lvl 35-50
void HumanWarriorStats(); //lvl35-50
void EnemyHumanWarriorStats(); //lvl 35-50
void HumanDualWieldStats(); //lvl 15-35
void EnemyHumanDualWieldStats(); //lvl 15-35
void HumanGladiatorStats(); //lvl 35-50
void EnemyHumanGladiatorStats(); //lvl 35-50
void HumanGuardianStats(); //lvl 35-50
void EnemyHumanGuardianStats(); //lvl 35-50
void HumanFighter2HStats(); //lvl 15-35
void EnemyHumanFighter2HStats(); //lvl 15-35
void HumanDestroyerStats(); //lvl 35-50
void EnemyHumanDestroyerStats(); //lvl 35-50
void HumanRaiderStats(); //lvl 35-50
void EnemyHumanRaiderStats(); //lvl 35-50
double HumanFG[10][12] =
//HP MP PA MA RA PD MD RD DB ACC CR AS
{ {.0701,.05997,.105,.092,.095,.061,.0590,.0490,.0571,.05107,.04512,.0177}, //F 0
{.0741,.06021,.110,.094,.096,.075,.0670,.0540,.0602,.05137,.04551,.0175}, //SS 1
{.0821,.06532,.125,.095,.097,.094,.0820,.0730,.0751,.05219,.04621,.0218}, //P 2
{.0831,.06604,.120,.082,.093,.101,.0935,.0805,.0761,.05155,.04561,.0182}, //W 3
{.0732,.06010,.124,.092,.095,.064,.0620,.0520,.0582,.05313,.05132,.0193}, //DW 4
{.0781,.07204,.132,.093,.095,.072,.0680,.0550,.0601,.05352,.05324,.0224}, //GU 5
{.0775,.06891,.141,.093,.095,.068,.0661,.0545,.0631,.05521,.05435,.0241}, //GL 6
{.0751,.06013,.127,.093,.098,.067,.0611,.0621,.0573,.05120,.04822,.0179}, //2H 7
{.0781,.06061,.131,.094,.098,.071,.0632,.0630,.0577,.05133,.05102,.0187}, //D 8
{.0773,.06121,.137,.095,.099,.067,.0622,.0613,.0575,.05127,.05210,.0192}}; //R 9
int HumanFS[12] =
{137,58,6,4,5,72,45,66,19,25,12,2};
int main()
{

ChooseRace();
std::cout << "What is your level?: ";
std::cin >> All::ylvl;
return 0;
}

void ChooseRace()
{
char chooser;
std::cout << "list of races:" <<endl;
std::cout << "1.) Human" << endl;
std::cout << "2.) Android" << endl;
std::cout << "3.) Angel" << endl;
std::cout << "4.) Demon" << endl;
std::cout << "what is your race?: ";
std::cin >> chooser;
if (chooser == '1')
{
ChooseClass();
}
}

void ChooseClass()
{
char choosec;
std::cout << "list of classes:" << endl;
std::cout << "1.) Fighter" << endl;
std::cout << "2.) Sword and Shield" << endl;
std::cout << "3.) Paladin" << endl;
std::cout << "4.) Warior" << endl;
std::cout << "5.) Dual Wield" << endl;
std::cout << "6.) Guardian" << endl;
std::cout << "7.) Gladiator" << endl;
std::cout << "8.) 2-Handed" << endl;
std::cout << "9.) Destroyer" << endl;
std::cout << "0.) Raider" << endl;
std::cout << "what is your class (type n for next 10)?: ";
std::cin >> choosec;
if (choosec == '1')
{
HumanFighterStats();
}
if (choosec == '2')
{
//HumanSwordAndShieldStats();
}
if (choosec == '3')
{
//HumanPaladinStats();
}
if (choosec == '4')
{
//HumanWarriorStats();
}
if (choosec == '5')
{
//HumanDualWieldStats();
}
if (choosec == '6')
{
//HumanGuardianStats();
}
if (choosec == '7')
{
//HumanGladiatorStats();
}
if (choosec == '8')
{
//HumanFighter2HStats();
}
if (choosec == '9')
{
//HumanDestroyerStats();
}
if (choosec == '0')
{
//HumanRaiderStats();
}
if (choosec == 'n')
{
//nextclasses.h
}
}


void HumanFighterStats()
{
All::ylvl--;
All::constant = (1+HumanFG[0][0]);
All::i= pow(All::constant, All::ylvl);
All::yhp = All::i* HumanFS[0];

All::constant = (1+HumanFG[0][1]);
All::i= pow(All::constant, All::ylvl);
All::ymp = All::i* HumanFS[1];

All::constant = (1+HumanFG[0][2]);
All::i= pow(All::constant, All::ylvl);
All::ypatk = All::i* HumanFS[2];

All::constant = (1+HumanFG[0][3]);
All::i= pow(All::constant, All::ylvl);
All::ymatk = All::i* HumanFS[3];

All::constant = (1+HumanFG[0][4]);
All::i= pow(All::constant, All::ylvl);
All::yratk = All::i* HumanFS[4];

All::constant = (1+HumanFG[0][5]);
All::i= pow(All::constant, All::ylvl);
All::ypdef = All::i* HumanFS[5];

All::constant = (1+HumanFG[0][6]);
All::i= pow(All::constant, All::ylvl);
All::ymdef = All::i* HumanFS[6];

All::constant = (1+HumanFG[0][7]);
All::i= pow(All::constant, All::ylvl);
All::yrdef = All::i* HumanFS[7];

All::constant = (1+HumanFG[0][8]);
All::i= pow(All::constant, All::ylvl);
All::ydb = All::i* HumanFS[8];

All::constant = (1+HumanFG[0][9]);
All::i= pow(All::constant, All::ylvl);
All::yacc = All::i* HumanFS[9];

All::constant = (1+HumanFG[0][10]);
All::i= pow(All::constant, All::ylvl);
All::ycr = All::i* HumanFS[10];

All::constant = (1+HumanFG[0][11]);
All::i= pow(All::constant, All::ylvl);
All::yas = All::i* HumanFS[11];

std::cout << "your stats look like this: " <<endl;
cout << All::yhp << "HP." <<endl;
cout << All::ymp << "MP." <<endl;
cout << All::ypatk << "P.Atk." << endl;
cout << All::ymatk << "M.Atk." << endl;
cout << All::yratk << "R.Atk." << endl;
cout << All::ypdef << "P.Def." << endl;
cout << All::ymdef << "M.Def." << endl;
cout << All::yrdef << "R.Def." << endl;
cout << All::ydb << "Dodge/Block." << endl;
cout << All::yacc << "Acc." << endl;
cout << All::ycr << "Crit. Rate." << endl;
cout << All::yas << "Atk.Spd." << endl;
}



All.h looks like this:

#ifndef new_tester2_All_h
#define new_tester2_All_h
#include <iostream>
#include <cmath>
using namespace std;
class All
{
public: All();
static char chooser;
static char choosec;
static char choosec2;
static char choosec3;
static char choosec4;
static char echooser;
static char echoosec;
static char echoosec2;
static int yhp;
static int ymp;
static int ypatk;
static int ypdef;
static int yratk;
static int yrdef;
static int ymatk;
static int ymdef;
static int ydb;
static int yacc;
static int ycr;
static int yas;
static char echoosec3;
static char echoosec4;
static int ehp;
static int emp;
static int epatk;
static int epdef;
static int eratk;
static int erdef;
static int ematk;
static int emdef;
static int edb;
static int eacc;
static int ecr;
static int eas;
static int x;
static double constant;
static double i;
static char chooseer;
static char chooseec;
static int ylvl;
static int y;
static int elvl;
int ypdamt = ypatk; //ypatk
int ypdamb = epdef; //epdef
int epdamt = epatk; //epatk
int epdamb = ypdef; //ypdef
int ypdamf = ypdamt/ypdamb;
int epdamf = epdamt/epdamb;
};


#endif


here is a picture of my error code: http://gyazo.com/d43310d4c5aa3717037910bec2b0ac70
(scrolling down, under the green part): http://gyazo.com/e63cb678a60b309b1debe00d787b0d35

not sure how to fix it at all.

thx for the help.
and yes, i am using xcode.
That's some extremely poor design right there. The code needs a complete rewrite. I'm serious, take the code behind the shed and put both barrels through its head.

The immediate problem is that static members need to be defined. For example,
1
2
3
4
5
6
7
//Foo.h
class Foo{
   static Bar baz;
};

//Foo.cpp
Bar Foo::baz;
they are defined in the All.h file. my problem isnt with the code, its some kind of architecture error or something... but please explain what you mean because in my header file, i define all of my static members
can anyone help?
Those are declarations, not definitions. Defining static members in headers usually (whenever more than one compilation unit includes the header) results in duplicate definition errors.
oh i see what you are saying. i think. basically what you are saying is that it makes the program think there are more of the same varriables?
Not exactly.

A declaration tells the compiler "there's a thing somewhere of this type and I promise you that you'll be able to find it with this name". A definition tells the compiler "on this translation unit, allocate space and/or generate code for this thing and name it like this". If two things are created with the same name, the linker will not be able to know which of the two a given name refers to, and it'll report it as a duplicate definition error, generally followed by a nearly-incomprehensible string (the mangled name of the thing).

Declaring but not defining a thing, like you're doing, breaks the promise you made to the compiler ("I promise you that you'll be able to find it with this name"). It translates to the linker generating an undefined reference error. Your toolchain is unusually nice and actually demangles the name before showing you the error; usually linker errors are much more horrible.
i think i understand now. how do i declare something then?
In my previous example, the definition of baz is in Foo.cpp.
i know that, but what is Bar? xD
It's a type. Duh?
mkay m8
Topic archived. No new replies allowed.