Add a built in precompiled macro to VC++ that points to the VC Tools version, like "14.10.25017"
In some header files we need to include particular Microsoft VC++ header files by path. To do it, we need to point to the directory that contains Microsoft VC++ header files.
With Microsoft Visual Studio 2015 and older, we can use the relative path, like “../VC”.
Starting from Microsoft Visual Studio 2017 the includes directory name contains full VC Tools version number, so we need a way to reference it somehow in a header file, so that Microsoft Visual C++ preprocessor could understand it.
In other words, the usage scenario is the following:
1. User runs cl.exe passing some files as an input and the files include the custom header file.
2. The custom header file needs to include MS VC++ header file by path. We need to somehow direct VC++ preprocessor to include certain header file, located in folder like “/14.10.25017/include”.
Andrew Pardoe [MSFT] commented
This won't work. There's already a predefined macro for the compiler version (see https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros) but the compiler gets updated in-place within a series of releases. This means you can end up with directory N containing compiler version N+2.
The solution to your problem is VSWhere: https://blogs.msdn.microsoft.com/heaths/2017/02/25/vswhere-available/