If you have a header file named ThisIsAHeaderFile.h, the following will still locate the file in Visual Studio:
#include <ThisIsAheaderFile.h>
Is there a way to enforce case sensitivity so that the #include will result in an error?
If you have a header file named ThisIsAHeaderFile.h, the following will still locate the file in Visual Studio:
#include <ThisIsAheaderFile.h>
Is there a way to enforce case sensitivity so that the #include will result in an error?
No, because the Windows file system is itself case-insensitive.
If you could get into a situation where you had both RICHIE.h and richie.h, it might make sense to control case sensitivity, but you can't.
Both FAT and NTFS are case insensitive file systems. Foo and fOO are the same file as far as they are concerned. Although the Windows OS will preserve the case you use for a file. If you name a file ThisIsAheaderFile.h it will show up that way in the file system. Although all system function calls to open that file can use any casing they want.
I have seen this be a problem when working with Unix code bases that may use two versions of the same file name, but with different case.
I still remember my feeling of disbelief when a friend of mine glowingly told me of this feature of the cool new system he'd learned, called "Unix". I just could not believe someone thought that having files "Cat" and "cat" be different things was actually a feature, and not just a bug caused by some idiot who decided to save a few CPU cycles by not same-casing names before comparison.
It is (used to be?) possible to create files with the same name but case differences on NTFS. Maybe someone with cygwin can verify this.
Even then, however, it's impossible to access more than one of these at a time from a normal Windows application.
Not a single person has actually answered the question: how do you enforce case sensitivity in the preprocessor?
I have no idea, but this is one of the reasons why I always compile my code regularly on Linux or using MinGW.
It's obvious that the Windows filesystem is case insensitive, but that has little to do with the preprocessor in VC, don't you think? :)