1

So I have two files, baseline.h and baseline.cpp. In baseline.h, I have created a class that declares multiple functions and variables, with a sample of one here:

#pragma once

class entity
{
protected:
    int x;
    int y;

public:
    void spawn(int bx, int by);
}

baseline.cpp tries to define the function as such:

#include "baseline.h"

void entity::spawn(int bx, int by)
{
    x = //functionality
    y = //functionality
}

I keep being met with the same errors: 'entity': is not a class or namespace name, followed by 'x': undeclared identifier and 'y': undeclared identifier.

Am I missing something incredibly obvious here?

Mark. L
  • 21
  • 1
  • 4
    Yes, a semicolon :) I'll let you find it – Rakete1111 Apr 04 '18 at 12:55
  • Do study the duplicate. C++ requires a `;` after the class declaration for good reasons. Compilers are not very good at issuing a good error message in such cases, due to the complexity of the language grammar. Upvoted the question though: this is not at all obvious on a first encounter and your question is well-written. – Bathsheba Apr 04 '18 at 12:58

0 Answers0