I am tasked with the job of porting several codebases that work in 6.0 to make them work in 2005, while still working in 6.0. The projects need to compile on both versions. As a solution to this (nightmare) problem, I have been told that the best way to do this is alot of #if and #endif statements all througout the code. 99% of all the errors or problem come from ifstream or ofstream. Includes have been set up as such in various places of the code. (To me it feels like somewhat of a hack job)
#define
MSC_VER 1400#if
MSC_VER > 1300#include
<fstream>#else
#include <fstream.h>
#endif
#if
MSC_VER > 1300std::ifstream PreferencesFile;
#else
ifstream PreferencesFile;
#endif
More or less, everything seems to work, if we type in that "#define MSC_VER 1400". But thats just a temp fix and it can not stay there in the actual file. I am trying to add this into the preprocessor definitions so the same code will work in 6.0 and in VS 2005. I go into the project properties, go to the C/C++ tab and go down to preprocessor and then into preprocessor definitions. I've tried adding MSC_VER, MSC_VER = 1400, MSC_VER 1400. Nothing seems to work, am I going about this the wrong way What must I do to make this work or is there maybe a better solution to accomplish this