![]() |
| | #1 | |
| Registered User Join Date: Sep 2008
Posts: 14
| What is Visual C++ saying? Quote:
Code: //Player behavior
class PLAYER
{
private:
//System
int level;
int gems; //Gems are money
int exp;
//Stats
int atk; //Attack
int def; //Defence
int spd; //Speed
int hlt; //Health
int amo; //Laser Energy
//Maxium
int MaxHlt; //Maxium Health
int MaxAmo; //Maxium Laser Energy
public:
void SetName(char* newname);
void GetName();
//Gems
void SetGems(int newgems);
void AddGems(int value);
int GetGems();
//Current Health and Laser Energy
void SetHlt(int newhlt); //Health
void AddHlt(int value);
int GetHlt();
void SetAmo(int newAmo); //Laser Energy
void AddAmo(int value);
int GetAmo();
//Stats
void SetAtk(int newatk); //Attack
int GetAtk();
void SetDef(int newdef); //Defence
int GetDef();
void SetSpd(int newspd); //Speed
int GetSpd();
void SetExp(int newexp); //Experience
void AddExp(int addexp);
int GetExp();
void SetMaxHlt(int newMaxHlt); //Max Health
int GetMaxHlt();
void SetMaxAmo(int newMaxAmo); //Max Laser Energy
int GetMaxAmo();
};
| |
| GlitchGuy2 is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| You have, probably, not defined the function SetAmo for that class. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #3 |
| Registered User Join Date: Aug 2002
Posts: 1,330
| It means that SetAmmo isn't defined anywhere that the linker knows to look. |
| BMJ is offline | |
| | #4 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,099
| Translation: player.obj : error LNK2001: The public class member function SetAmo that takes an int that is located in the class PLAYER was not found. Please implement it. C:\Documents and Settings\Glitch\Desktop\Games\Skets series\Skets in CRYSTAL BOND\Release\Skets in CRYSTAL BOND.exe : fatal error LNK1120: 1 function could not be found.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #5 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| It means you declared SetAmo(int) but failed to define it.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is offline | |
| | #6 | |
| The larch Join Date: May 2006
Posts: 3,082
| One mistake I make quite often that can result is that when the function is defined I forget to mark it as a member function. Code: //void SetAmo(int newAmo) {...}
void PLAYER::SetAmo(int newAmo) {...}
However, it also shows that this class is supposed to be entirely controlled from the outside and the only purpose it serves is hiding the data, hence making external controlling more awkward. I don't mean that you should make the members public, but might instead consider moving some of the functionality into the class. What you should see as a result are method names that describe actual actions (attack, defend, level_up, buy_ammo etc) rather than name manipulations of particular member variables. (Getters are somewhat more acceptable - you may want to query the class for info -, but abundance of setters indicates that the class might not be doing much useful.)
__________________ I might be wrong. Quote:
| |
| anon is offline | |
![]() |
| Tags |
| c++, error, rpg, text, visual |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| We Got _DEBUG Errors | Tonto | Windows Programming | 5 | 12-22-2006 05:45 PM |
| C++ std routines | siavoshkc | C++ Programming | 33 | 07-28-2006 12:13 AM |
| load gif into program | willc0de4food | Windows Programming | 14 | 01-11-2006 10:43 AM |
| Errors with including winsock 2 lib | gamingdl'er | C++ Programming | 3 | 12-05-2005 08:13 PM |
| Learning OpenGL | HQSneaker | C++ Programming | 7 | 08-06-2004 08:57 AM |