Archived

This topic is now archived and is closed to further replies.

link error in VC++ 6

This topic is 5377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's my errors: Draw.obj : error LNK2001: unresolved external symbol "public: __thiscall Player::~Player(void)" (??1Player@@QAE@XZ) Draw.obj : error LNK2001: unresolved external symbol "public: __thiscall Player:: Player(void)" (??0Player@@QAE@XZ) Debug/DX.exe : fatal error LNK1120: 2 unresolved externals in Draw.cpp, i got:
   
   
#include "Player.h"

int MainGame()
{
	Player Joueur;
	if(Joueur.SetPlayerEntity(0))
	{}
	DrawGLScene();

	return true;
}
   
and in Player.h:
     
#ifndef _Player_H
#define _Player_H

#include "Entity.h"

class Player {

private:
	Entity PlayerEntity;
public:
	// Typical constructor

	Player();
	// Typical destructor

	~Player();

	bool SetPlayerEntity(int NoEntity)
	{
		return true;
	};
};


#endif
      
You can see that the class isn't complete yet, but it is only a test, the prob is, why doesn't it aknowledge my constructors/destructor of my class? thanks [edited by - ErayMan on March 25, 2003 8:41:36 PM]

Share this post


Link to post
Share on other sites
those are just constructor/destructor declarations. in Player.cpp you need to have the function bodies declared like such:


    

#include "player.h"

Player::Player()
{
}

Player::~Player()
{
}



you could do the same thing, but in player.h, like you have with SetPlayerEntity, but it's good practice to seperate the code from the declarations, and can save some tricky bugs later on in a programs development.

| - Project-X - my mega project.. getting warmer - | - adDeath - an ad blocker I made - | - email me - |

[edited by - RipTorn on March 25, 2003 9:24:59 PM]

Share this post


Link to post
Share on other sites