The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ld: fatal: Symbol referencing errors. No output written to SNX jerryragland High Level Programming 1 08-09-2006 01:15 AM
symbol referencing error suhasini High Level Programming 1 04-03-2006 06:43 AM
ld: 0711-317 ERROR: Undefined symbol: .hello stockdan High Level Programming 2 11-25-2003 05:43 AM
ld: fatal: Symbol referencing errors alfabetman UNIX for Dummies Questions & Answers 2 01-08-2002 04:57 AM
Compiling Errors -- Symbol referencing spotanddot High Level Programming 5 07-11-2001 01:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-13-2008
fromatz fromatz is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 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:

};
battleground.cpp
Code:
#include "battleground.h"
using namespace std;
player.h
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);

};
player.cpp
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)
{

}
pvpranks.cpp
Code:
#include "battleground.h"
using namespace std;

int main()
{
    Battleground session[50];

    return 0;
}
  #2 (permalink)  
Old 03-17-2008
odys odys is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 59
Hello,

I think you need to replace [in Player::Player()]:
pname = "\0";
to something like this:
pname[0]='\0';
etc.

Miroslaw
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0