alx*_*cyl 15 c++ xcode cocos2d-x
现在这是一个奇怪的问题.我两天前编码并停止,然后继续.在我的头文件(Fruit.h
)上,我添加了一个名为animateGrow()
like 的方法:
Fruit.h:
class Fruit {
private:
// Member variables here
public:
// Other methods here
void animateGrow( );
};
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在CPP文件中添加相同的方法时,我收到Out-of-line definition of 'animateGrow' does not match any declaration in 'Fruit'
错误.它在标题中声明,但Xcode似乎无法找到该方法.
Fruit.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.
}
Run Code Online (Sandbox Code Playgroud)
完整代码 :(链接已删除)(在代码中,Tree
类存在,所有其他方法和函数工作正常,除了animateGrow()
它给我错误)
alx*_*cyl 10
固定它.
我不知道为什么但是Xcode没有在头文件中保存我的更改.我关闭了Xcode并打开了头文件,并且没有更改.我再次添加了方法并保存了.我打开CPP文件添加了新方法,它工作得很好.
真的很奇怪.