Everytime I try to compile a class in c++ I get this error:
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
Here is the code for my Classes class:
#include <iostream>
#include "Cat.h"
using namespace std;
int main() {
Cat cat1;
cat1.speak();
cat1.jump();
return 0;
}
Here is the code for my header Cat.h:
#ifndef CAT_H_
#define CAT_H_
class Cat {
public:
void speak();
void jump();
};
#endif /* CAT_H_ */
And here is the code for my Cat Class:
#include <iostream>
#include "Cat.h"
using namespace std;
void Cat::speak() {
cout << "Meouwww!!!" << endl;
}
void Cat::jump() {
cout << "Jumping to top of bookcase" << endl;
}
This error have nothing to do with your code. It's a problem related to your environnement. There is 2 commun mistake that will lead to this:
There is no compiler associated with your IDE so try to install one. Or you should Download codeBlocks with mingw compiler integrated
You didn't create a project So try creating a project and then add this files.
I hope that I answered your question.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.