3

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;
}
1
  • 1
    You should learn a bit about the IDE you're using, or run some tutorial. Commented Feb 11, 2017 at 23:32

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

7 Comments

How do I create a project in codeblocks? I have tried to create one but failed multiple times and I have experienced permanent agonizing pain
try watching this : youtube.com/watch?v=i1kubuz1loI go directly to 1:57 if you want
I created the project , then I added all of the files to the folder of the project and I am still getting the same error when I attempt to compile it. So complicated
Am I required to install mingw in order for a class file to compile?
I did not install mingw when I initially installed codeblocks
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.