【发布时间】:2012-08-06 06:25:49
【问题描述】:
现在这是一个奇怪的问题。两天前我在编码,然后停下来,然后继续。在我的头文件 (Fruit.h) 上,我添加了一个名为 animateGrow() 的方法,如下所示:
水果.h:
class Fruit {
private:
// Member variables here
public:
// Other methods here
void animateGrow( );
};
但是当我尝试在 CPP 文件中添加相同的方法时,我收到了 Out-of-line definition of 'animateGrow' does not match any declaration in 'Fruit' 错误。它已在标头中声明,但 Xcode 似乎无法找到该方法。
水果.cpp:
#include "SimpleAudioEngine.h"
#include "Fruit.h"
#include "Tree.h"
using namespace cocos2d;
using namespace CocosDenshion;
Fruit::Fruit( ) {
// Constructor
}
// Getter Methods
// Setter Methods
// Other Methods
void Fruit::animateGrow( ) {
// I get an error here when I type it.
}
完整代码:(链接已删除)
(在代码中,Tree 类存在,所有其他方法和函数都可以正常工作,除了 animateGrow() 因为它给了我错误)
【问题讨论】:
-
您应该关闭这个问题,因为它对未来用户的用处仅限于没有。很高兴你修好了,祝你好运。
-
@DavidRodríguez-dribeas 如何关闭问题?抱歉,我不熟悉这个。
-
嗯...标签下面没有链接吗? (可能是你需要一些声誉才能做到这一点......如果链接不存在,别担心,其他人会关闭它——我已经投票关闭,它只需要多几票:)
-
@DavidRodríguez-dribeas 哦,没有关闭链接,只是分享、编辑、删除和标记。谢谢:)
-
我不同意 - 我今天来到这里寻找完全相同的错误消息的解决方案,并且对此问题有 6 个赞成票。建议重新开放。