I've written a Unit testing framework for an embedded system that reports the location of tests using __FILE__ and __LINE__. This is all well and good, except I also want to run the code on Visual Studio.
Now microsoft, in their infinite wisdom, change the meaning of __FILE__ depending on other compiler switches. For example if /Zi (note case of 'i') is defined __FILE__ is the relative path (to the project), but if /ZI is defined __FILE__ is the absolute path!!! (these, btw, defined the debugger database format. Imagining how that relates __FILE__ fills with horror)
The path needs to be absolute so our reporting tools can load those files. so I'd like to force users to specify /FC (an undocumented switch that creates absolute paths ). I tried:
but unfortunately that doesn't work. Anyone know a way that does? and yes, I've STFW...
#if defined(WIN32) && !defined(FC)
#error Please add /FC to your compiler options