Background: I'm working on a legacy project in C++. While extending the functionality of a base class(specifically I'm adding multi-threading support), I had to modify a header file. Let's call the base class header fooBuilder.h . fooBuilder.h defines a builder object that is used heavily later in the code. To implement multi-threading, I included a bunch of windows specific headers.
Problem: In the other source files that include fooBuilder.h(among other header files), I get "error C2371: '[windows variable name]' : redefinition; " errors during compilation. Obviously, if I could change EVERY source file in my project to include fooBuilder.h as the first header file I'm good, but there are a 101 files which include fooBuilder.h! Abstracting out the windows specific headers into stdafx.h is not an option. What is the best way to overcome this situation? I'm open to any and all suggestions. I really don't want to change the "#include fooBuilder.h" position for every file!