How to force Visual Studio preprocessor case sensitivity with #includes?

后端 未结 5 1074
一生所求
一生所求 2021-02-14 03:38

If you have a header file named ThisIsAHeaderFile.h, the following will still locate the file in Visual Studio:

#include 
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-14 04:22

    While it might not be possible to enforce this from within Visual Studio, one could implement a quick check by running only the preprocessor on the C/C++ source. This will run quickly enough to be practicable even as post-commit hook in a version control system, and err if the case in file names has been mismatched. So:

    • Configure your build system in Linux to support preprocessor-only runs (-E with gcc/g++)

    • Implement a preprocessor-only run as post-commit hook, triggering an early notification to the responsible person and/or to someone willing to routinely fix these errors

    Of course, this assumes a VCS as central storage for the code.

提交回复
热议问题