[演员.h]
#include "../PathEngine/Actor.h"
namespace FightEngine
{
class Actor
:public PathEngine::Actor
{
private:
.....
public:
Actor();
~Actor();
void SetPosition(int x, int y);
};
}
[演员.cpp]
#include "Actor.h"
namespace FightEngine
{
Actor::Actor()
:PathEngine::Actor()
{
do something
}
Actor::~Actor()
{
}
void Actor::SetPosition(int x, int y)
{
do something
}
}
[主.cpp]
FightEngine::Actor* actor = new FightEngine::Actor();
actor->SetPosition(400,200);
它给了我一些
>
错误 LNK2019:未解析的外部符号....
我猜 Actor::SetPosition(x,y)、Actor::Actor() 已声明但未定义。但我实际上在 Actor.cpp 中定义了它。问题是编译器不编译 Actor.cpp,我不知道为什么。