![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ld: fatal: Symbol referencing errors. No output written to SNX | jerryragland | High Level Programming | 1 | 08-08-2006 10:15 PM |
| symbol referencing error | suhasini | High Level Programming | 1 | 04-03-2006 03:43 AM |
| ld: 0711-317 ERROR: Undefined symbol: .hello | stockdan | High Level Programming | 2 | 11-25-2003 02:43 AM |
| ld: fatal: Symbol referencing errors | alfabetman | UNIX for Dummies Questions & Answers | 2 | 01-08-2002 01:57 AM |
| Compiling Errors -- Symbol referencing | spotanddot | High Level Programming | 5 | 07-11-2001 10:18 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Symbol referencing error
Hey everyone, I can't figure out this symbol referencing error after looking at it for the longest time, and I figured some fresh eyes might be able to point something out I am overlooking.
Undefined first referenced symbol in file Player::Player() /var/tmp/ccqbgWea.o ld: fatal: Symbol referencing errors. No output written to a.out collect2: ld returned 1 exit status I've looked at all my files and Player() is declared in the Player class. And in my player.cpp file (contains implementations of public member functions of Player) I have included "player.h" (stores my declaration of the class) I know my battleground.h and .cpp are not complete but it should still compile fine. I know once I add a constructor in for Battleground it will also give me another symbol referencing error like Battleground::Battleground() I compile using: g++ pvpranks.cpp Here is the code if it will help: battleground.h Code:
#include "player.h"
class Battleground
{
private:
Player bgPlayers[40];
public:
};
Code:
#include "battleground.h" using namespace std; Code:
class Player
{
private:
char pname[13];
char pserver[50];
char prace[10];
char pclass[8];
int pkillingblows;
int phonorkills;
int pdeaths;
int phonorgained;
int pfaction;
int prank;
int pdamage;
int phealing;
int pflagcaps;
int pbasesassaulted;
int pflagreturns;
int pbasesdefended;
public:
Player();
void set_pname(char pn[]);
void set_pserver(char ps[]);
void set_prace(char prac[]);
void set_pclass(char pc[]);
void set_pkillingblows(int pkb);
void set_phonorkills(int phk);
void set_pdeaths(int pde);
void set_phonorgained(int phg);
void set_pfaction(int pfa);
void set_prank(int pran);
void set_pdamage(int pda);
void set_phealing(int ph);
void set_pflagcaps(int pflagc);
void set_pbasesassaulted(int pbasesa);
void set_pflagreturns(int pflagr);
void set_pbasesdefended(int pbasesd);
};
Code:
#include "player.h"
using namespace std;
Player::Player()
{
pname = "\0";
pserver = "\0";
prace = "\0";
pclass = "\0";
pkillingblows = 0;
phonorkills = 0;
pdeaths = 0;
phonorgained = 0;
pfaction = 0;
prank = 0;
pdamage = 0;
phealing = 0;
pflagcaps = 0;
pbasesassaulted = 0;
pflagreturns = 0;
pbasesdefended = 0;
}
void Player::set_pname(char pn[])
{
}
void Player::set_pserver(char ps[])
{
}
void Player::set_prace(char prac[])
{
}
void Player::set_pclass(char pc[])
{
}
void Player::set_pkillingblows(int pkb)
{
}
void Player::set_phonorkills(int phk)
{
}
void Player::set_pdeaths(int pde)
{
}
void Player::set_phonorgained(int phg)
{
}
void Player::set_pfaction(int pfa)
{
}
void Player::set_prank(int pran)
{
}
void Player::set_pdamage(int pda)
{
}
void Player::set_phealing(int ph)
{
}
void Player::set_pflagcaps(int pflagc)
{
}
void Player::set_pbasesassaulted(int pbasesa)
{
}
void Player::set_pflagreturns(int pflagr)
{
}
void Player::set_pbasesdefended(int pbasesd)
{
}
Code:
#include "battleground.h"
using namespace std;
int main()
{
Battleground session[50];
return 0;
}
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hello,
I think you need to replace [in Player::Player()]: pname = "\0"; to something like this: pname[0]='\0'; etc. Miroslaw |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|