set proper environment path variables for Visual studio - visual-studio

How to set proper environment path variable for the visual studio in windows
like VSINSTALLDIR, VCINSTALLDIR ,ETC
I will add my own answer as I struggled with this a lot, others are also welcomed to make this answer better.
Thank You!

I was struggling and getting lots of errors while setting proper path variables for Visual Studio on Windows.
People use this directly VCINSTALLDIR, VSINSTALLDIR, many newcomers like me face problems so I thought to add this here.
SET INCLUDE
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\include;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\winrt;D:\Program Files\MATLAB\R2020a\extern\include;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\include;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.17763.0\winrt;D:\Program Files\MATLAB\R2020a\extern\include;
SET LIB
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\lib\x64;C:\Program Files (x86)\Windows Kits\10\\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.17763.0\um\x64;D:\Program Files\MATLAB\R2020a\lib\win64;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\lib\x64;C:\Program Files (x86)\Windows Kits\10\\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.17763.0\um\x64;D:\Program Files\MATLAB\R2020a\lib\win64;
Others are also welcome to add to it.
My path contains this
%MS_VS17%\Community\;
%MS_VS17%\Community\VC\Tools\MSVC\14.16.27023\bin;
%MS_VS17%\Community\VC\Tools\MSVC\14.16.27023\include;
%MS_VS17%\Community\Common7\IDE;%MS_VS17%\Community\Common7\Tools;
%MS_VS17%\Community\VC\Auxiliary\Build;
%MS_VS17%\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64;
%MS_VS17%\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x86;

Related

Cannot open file 'pgort.llib' after adding /GENPROFILE flag

I'm trying to follow the instructions here to add PGO for my project. After I added the /GENPROFILE flag, I start getting the link error:
LINK : fatal error LNK1104: cannot open file 'pgort.lib'
After debugging it a bit, I believe the problem is that my Library Directories (found under VC++ Directories tab) has a value of $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) which is evaluating to:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\atlmfc\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\lib\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\UnitTest\lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64
It looks like the .\spectre\x64 paths don't have the pgort.lib library, but the non-spectre path does:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64
What do I do to fix this? I find it hard to believe that if I'm using the spectre binaries (which I am not even sure how/why I am in the first place) that I can't optimize my project.
BTW, I tried this on a machine with Enterprise VS installed and it's the same. So this isn't specific to Community edition.
I ended up updating my build configuration/scripts to dynamically update the LibraryPath to add the appropriate, architecture-specific version of $(VC_LibraryPath_VC_x64_Desktop) when compiling for PGO.

fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory

I am referring to C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ WDK files. Though I have installed latest 10.0.15063.0. It seems some files are missing in 10.0.14393 folder.
Anyone could help me to in this. Reparing Microsoft Visual Studio15 or reparing wdk 10.0.15063 does not help.
Ensure you have installed "Universal CRT" component of your visual studio.
More over for newer versions of Visual studio
in case the directory "C:\Program Files\Windows Kits" exists on your system ensure that it contains "10/Include" and "10/Lib" subdirectories.
If not create hard links there to thoose present in your "C:\Program Files (x86)\Windows Kits\10"
As you can see from C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\uCRT.props
the path "C:\Program Files\Windows Kits" is prefered over "C:\Program Files (x86)\Windows Kits" if it exists.
In Visual studio go to Project -> Properties -> VC++ Directories -> Include Directories and add:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
In Project -> Properties -> VC++ Directories -> Library Directories add:
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64
That's it, your program should now compile without errors!

Open Windows SDK command prompt in Windows 10

I have Installed Windows SDK on windows 10 from here
https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
But I am unable to open Windows SDK command prompt to run my maven commands to install hadoop. I have searched online but didn't find anything useful. Please help.
The Windows 7.1 SDK was really the last one to include it's own "Command Prompt". For Windows 8.x and Windows 10 SDK, you usually install Visual Studio to get the Windows SDK which provides the "Developer Command Prompt" shortcut.
Keep in mind that the Windows 10 SDK uses a "side-by-side" model so C:\Program Files (x86)\Windows Kits\10\Include or Lib\<arch> is not sufficient to point to the include/lib path. You need to add a version string. For example, for the November 2015 update, it would be C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0 and C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\<arch>
In the Visual Studio 2015 Developer Command Prompt, you will see the following environment variables:
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10\
WindowsSDKLibVersion=10.0.10586.0\
WindowsSDKVersion=10.0.10586.0\
INCLUDE=...C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt;
C:\Program Files (x86)\Windows Kit s\NETFXSDK\4.6.1\include\um;
C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared;
C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um;
C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt;
LIB=...C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64;
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64;
C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64;
LIBPATH=...C:\Program Files (x86)\Windows Kits\10\UnionMetadata;
C:\Program Files (x86)\Windows Kits\10\References;
C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;

APPX0502 Build fail in tfs but work in visual studio 2015

I had many problems, but this is something that can not be resolved when the TFS makes a compilation fails but works well when the compilation is done from the Visual Studio 2015.
I have installed: TFS 2015.
Error:
(1736,5): Error APPX0502: File 'C:\Program Files %28x86%29\Windows
Kits\10\Include\WinRT\AppxManifestSchema2010_v2.xsd' not found.
I hope someone can help me.
I resolved this on my Dev Machine by copying 2 files from the Win8.1 Kit to the Win10 kit folders
Source:
"C:\Program Files
(x86)\Windows Kits\8.1\Include\winrt\AppxManifestSchema2010_v2.xsd"
"C:\Program Files (x86)\Windows
Kits\8.1\Include\winrt\AppxManifestSchema2013.xsd"
Target:
"C:\Program Files (x86)\Windows
Kits\10\Include\winrt\AppxManifestSchema2010_v2.xsd"
"C:\Program
Files (x86)\Windows Kits\10\Include\winrt\AppxManifestSchema2013.xsd"
No idea how legit this is, or why it it needed for building from MSBuild when you can build fine in VS.

VS2012 doesn't include winres.h any more?

After installing VS2012, I can't find winres.h under folder "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC". What happen to VS2012 and why remove this header file?
By the way, in VS2010, winres.h locates in "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include"
The file is part of the Windows SDK now and since VS2012 the SDK location is different, it's now called a 'Kit' and is found in Program Files/Windows Kits. Sepcifically you can find winres.h in
C:\Program Files (x86)\Windows Kits\8.0\Include\um

Resources