Each module that includes ImageManager.h will declare a global variable named ImageManager of type class ImageManager.
So main.cpp says: Hey, I've got a global variable named ImageManager, and everyone can muck with it.
And ImageManager.cpp says: Hey, I've got a global variable named ImageManager and everyone can muck with it.
The linker says: Whoa....main and ImageManager both have variables named ImageManager. I can't be sure they are talking about the same thing here, so I'm not going to guess and risk guessing wrong. Barf.
There are a couple ways to fix it:
1) In the .h file, make ImageManager (the variable) an extern:
extern class ImageManager ImageManager;
Then, in ImageManager.cpp, declare the actual instance:
class ImageManager ImageManager;
2) Use the singleton pattern: Give the ImageManager class a public static function that returns your one and only ImageManager object. You would declare that in ImageManager.cpp as static class ImageManager ImageManager;. This method would just return ImageManager;
2 is cleaner than 1, Global variables are bad, in general. But takes a bit more work to implement.
Side note: My C++ is a bit rusty, haven't used it for 3 years. So I may be a tad off on the syntax above, but it should be close.
Side note 2: When I first moved from C++ (a language I used to love) to C# (my current love), I really thought I would miss header files. They seemed like such a good idea at the time. I don't. Header files are something they used back in the dark ages. There's no need for them today.
ETA: I wrote Factory pattern in my original post. Brain fart wrong. Edited to say Singleton pattern as it should.