At the moment I am trying to declare a global object in c++ as follows:
in globals.h
#pragma once
#include "Class.h"
extern Class *obj;
then in a separate file called globals.cpp I have
#include "globals.h"
Class *obj;
And then in main.cpp I have
#include "globals.h"
But the compiler throws this error at me
in globals.h: error C2143: syntax error : missing ';' before '*'
I don't understand this since this post: c++ global object explains that this is the way it's done.