c ++编译错误“重新定义”,需要帮助才能找到它

时间:2011-09-11 11:02:45

标签: c++ include compiler-errors

很长一段时间我不使用C ++而且我对它不太友好。我正在恢复我的旧项目并尝试编译它,但我得到以下错误输出启动Makefile:

g++ -W -ggdb3 -Wall -ansi -pedantic  -c main.cpp
In file included from Entity3d.h:4,
                 from SceneManager.h:10,
                 from main.cpp:5:
Entity.h:82: warning: unused parameter ‘rot’
Entity.h:82: warning: unused parameter ‘delta’
Entity.h:82: warning: unused parameter ‘scale’
In file included from SceneManager.h:20,
                 from main.cpp:5:
GamePlayer.h:52: error: redefinition of ‘Vector3d delta’
GamePlayer.h:52: error: ‘Vector3d delta’ previously declared here
main.cpp:7: warning: second argument of ‘int main(int, char*)’ should be ‘char **’
make: *** [main.o] Error 1

GamePlayer.h:52的位置是:

void Behavior(Vector3d rot, Vector3d delta, Vector3d delta);

行为覆盖了它的父类(Entity.h)的函数:

virtual void Behavior(Vector3d rot, Vector3d delta, Vector3d scale) {};

类的层次结构如下:

class GamePlayer : public Entity3d
class Entity3d : public Entity

我检查了包含警卫,这似乎是正确的。

有人能让我朝着正确的方向前进吗?

1 个答案:

答案 0 :(得分:6)

您对两个参数使用了相同的名称:

... Vector3d delta, Vector3d delta);