Reputation: 153
My question is not answered by this question because I made a very different type of mistake, I now know. The project was incorrectly set up. It needed to be a console application for my purposes which it was not.
I am a new C++ programmer. I'm using Code::Blocks and working on Windows, and every time I try to add a class to my project, it begins returning this same error, even though it appears as if I'm telling my project where to build to (which was the solution suggested in this question).
Here is my attempted code:
main.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Monster.h
#ifndef MONSTER_H
#define MONSTER_H
class Monster
{
public:
Monster();
virtual ~Monster();
protected:
private:
};
#endif // MONSTER_H
Monster.cpp
#include "Monster.h"
Monster::Monster()
{
//ctor
}
Monster::~Monster()
{
//dtor
}
Upvotes: 0
Views: 306
Reputation: 261
Seems like the project is configured as a Windows application rather than a console application.
Since you are using int main it will not know where to start.
You can set the entry point to int main function in the Code::Blocks additional linker options by adding '/entry:mainCRTStartup', or just as easily create a new console application workspace.
Upvotes: 1