I am stll having problems using multiple files. I am writing a simple program in VC.Net 2003, and get this error:
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'a' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'b' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'c' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'd' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(10) : error C2448: 'Player::__ctor' : function-style initializer appears to be a function definition
/**
* \file main.cpp
* \author Catherine Heathcote
* \date 02-09-2004
*/
#include <iostream>
#include "player.h"
using namespace std;
int main()
{
struct Char
{
char ForeName;
char SurName;
char Gender;
int Age;
};
/** \struct Input
* \brief Temporary player details
*
* Temporary holding space for the details needed to create a player using the Player class.
* The data entered here can be deleted after the Player object has been created.
*/
Char Input;
cout<<"What is your first name?"<<endl<<": ";
cin>>Input.ForeName;
cout<<"And your surname is..."<<endl<<": ";
cin>>Input.SurName;
cout<<"*sigh* Male or Female?"<<endl<<": ";
cin>>Input.Gender;
cout<<"OK "<<Input.ForeName<<", how old are you?"<<endl<<": ";
cin>>Input.Age;
return 0;
}
/**
* \file player.h
* \author Catherine Heathcote
* \date 02-09-2004
*/
#ifndef PLAYER_H
#define PLAYER_H
/** \class Player
* \brief Player Class
*
* Everything to do with the player will be done
*/
class Player
{
private:
char ForeName;
char SurName;
char Gender;
int Age;
int Level;
int Experiance;
public:
/**
The constructor
\param a Player's forename
\param b Player's surname
\param c Player's gender
\param d Player's age
*/
Player(char a, char b, char c, int d);
///The Destructor
~Player();
};
#endif
/**
* \file player.cpp
* \author Catherine Heathcote
* \date 02-09-2004
*/
#include "player.h"
Player::Player(a, b, c, d)
{
ForeName = a;
SurName = b;
Gender = c;
Age = d;
Level = 1;
Experiance = 0;
}
Player::Player()
{
}
Im writing such a silly little thing for two reasons, I *really* need to get multiple files working right, and as you can probably see, im starting to use doxygen
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'a' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'b' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'c' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(9) : error C2065: 'd' : undeclared identifier
c:\Documents and Settings\Silvanus\My Documents\Visual Studio Projects\CharGen\player.cpp(10) : error C2448: 'Player::__ctor' : function-style initializer appears to be a function definition
/**
* \file main.cpp
* \author Catherine Heathcote
* \date 02-09-2004
*/
#include <iostream>
#include "player.h"
using namespace std;
int main()
{
struct Char
{
char ForeName;
char SurName;
char Gender;
int Age;
};
/** \struct Input
* \brief Temporary player details
*
* Temporary holding space for the details needed to create a player using the Player class.
* The data entered here can be deleted after the Player object has been created.
*/
Char Input;
cout<<"What is your first name?"<<endl<<": ";
cin>>Input.ForeName;
cout<<"And your surname is..."<<endl<<": ";
cin>>Input.SurName;
cout<<"*sigh* Male or Female?"<<endl<<": ";
cin>>Input.Gender;
cout<<"OK "<<Input.ForeName<<", how old are you?"<<endl<<": ";
cin>>Input.Age;
return 0;
}
/**
* \file player.h
* \author Catherine Heathcote
* \date 02-09-2004
*/
#ifndef PLAYER_H
#define PLAYER_H
/** \class Player
* \brief Player Class
*
* Everything to do with the player will be done
*/
class Player
{
private:
char ForeName;
char SurName;
char Gender;
int Age;
int Level;
int Experiance;
public:
/**
The constructor
\param a Player's forename
\param b Player's surname
\param c Player's gender
\param d Player's age
*/
Player(char a, char b, char c, int d);
///The Destructor
~Player();
};
#endif
/**
* \file player.cpp
* \author Catherine Heathcote
* \date 02-09-2004
*/
#include "player.h"
Player::Player(a, b, c, d)
{
ForeName = a;
SurName = b;
Gender = c;
Age = d;
Level = 1;
Experiance = 0;
}
Player::Player()
{
}
Im writing such a silly little thing for two reasons, I *really* need to get multiple files working right, and as you can probably see, im starting to use doxygen
