Globals and dupications

Eww i know, globals...

I need a global to be accessible to multiple files

Right now i have this

1
2
3
4
5
6
//class.h
#include "Globals.h"
class foo {
public:
  void FunctionThatUsesAGlobal();
};

1
2
3
4
5
6
//main.cpp
#include "class.h"
//bla bla bla
foo Foo;
Globalenum = left;
Foo.FunctionThatUsesAGlobal();

I keep getting a duplication error in the linking phase. I tried declaring the global as extern in the global header file and then implementing it in the main file then declaring it extern in the foo header file but that still didnt work.
Topic archived. No new replies allowed.