每次我尝试编译C++类时,都会出现以下错误:
这是我的猫类的代码:
这是我的Classes类的代码:||=== 构建文件:“无目标”于“无项目”(编译器:未知)===|
#include <iostream>
#include "Cat.h"
using namespace std;
int main() {
Cat cat1;
cat1.speak();
cat1.jump();
return 0;
}
以下是我的头文件Cat.h的代码:
#ifndef CAT_H_
#define CAT_H_
class Cat {
public:
void speak();
void jump();
};
#endif /* CAT_H_ */
这是我的猫类的代码:
cat 类的代码如下:
#include <iostream>
#include "Cat.h"
using namespace std;
void Cat::speak() {
cout << "Meouwww!!!" << endl;
}
void Cat::jump() {
cout << "Jumping to top of bookcase" << endl;
}