C ++编译顺序

时间:2013-05-30 09:08:46

标签: c++

[Actor.h]

#include "../PathEngine/Actor.h"
namespace FightEngine
{
    class Actor
        :public PathEngine::Actor
    {
    private:
        .....
    public:
        Actor();
        ~Actor();
        void SetPosition(int x, int y);
    };
}

[Actor.cpp]

#include "Actor.h"
namespace FightEngine
{
    Actor::Actor()
        :PathEngine::Actor()
    {
        do something
    }
    Actor::~Actor()
    {

    }
    void Actor::SetPosition(int x, int y)
    {
        do something
    }
}

[main.cpp中]

FightEngine::Actor* actor = new FightEngine::Actor();
actor->SetPosition(400,200);

它给了我一些

>

  

错误LNK2019:未解析的外部符号....

我猜是Actor :: SetPosition(x,y),Actor :: Actor(),声明但未定义。但我在Actor.cpp中实际定义了它。问题是编译器不编译Actor.cpp,我不知道为什么。

0 个答案:

没有答案