Class pointer weird ass error

Nov 27, 2021 at 7:49am
Entity* entity;

C2238 unexpected token(s) preceeding ';'
C2413 syntax error : missing ';' before '*'
C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Nov 27, 2021 at 9:00am
Probably missing a semicolon ; at the end of the class Entity
Nov 27, 2021 at 4:24pm
Probably missing a semicolon ; at the end of the class Entity

Or at the end of line preceding the one you showed us.
Nov 27, 2021 at 6:07pm
I won't show includes,variables,functions etc.

Entity.h

1
2
3
4
5
6
7
8
9
10
11
#pragma once
#include "MainWindow.h"

class Entity
{
private:

public:
	Entity();
      ~Entity();
};


MainWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once
#include "Entity.h"

class MainWindow
{
private:

	Entity* entity;
public:
	MainWindow();
	~MainWindow();
};


Edit : btw it's a post build error
Last edited on Nov 27, 2021 at 6:14pm
Nov 27, 2021 at 6:25pm
You have recursive includes.

entity.h includes mainwindow.h and mainwindow.h includes entity.h.
You can't do that.

Remove the include of mainwindow.h from entity.h.
entity.h doesn't need it.

Nov 27, 2021 at 6:37pm
Ohh i actually thought of that before but i didn't even try. Thanks
Last edited on Nov 27, 2021 at 6:37pm
Topic archived. No new replies allowed.