windowsvisual-c++visual-studio-2015clvcbuild

windows vc++ how to use UniversalCRT_IncludePath and How to make it work in cl.exe


I use windows 10 as test server and try to build from source code of python & C++. I installed vcbuild 2015 by choco choco windows package manager

When I try to build the source, I find error.

E:\downloads\Twisted-17.1.0>cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -IC:\Python36\include -IC:\Python36\include /Tcsrc/twisted/test/raiser.c /Fobuild\temp.win-amd64-3.6\Release\src/twisted/test/raiser.obj
raiser.c

c:\python36\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory

I can not find the io.h in my vc++ include path: But according to the passage: Universal CRT

I find the io.h file is in my C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt

Then I find my Universal CRT is empty

C:\WINDOWS\system32>set UniversalCRT_IncludePath
Environment variable UniversalCRT_IncludePath not defined

Then I define that envirnoment variable:

E:\downloads\Twisted-17.1.0> set UniversalCRT_IncludePath="C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"

Then I try to compile the source code again, but I still get an error:

E:\downloads\Twisted-17.1.0>cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -IC:\Python36\include -IC:\Python36\include /Tcsrc/twisted/test/raiser.c /Fobuild\temp.win-amd64-3.6\Release\src/twisted/test/raiser.obj
raiser.c

c:\python36\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory

Anyone know how to make the UniversalCRT_IncludePath works in command line environment, how cl.exe try to use that variable and make it including default c++ including path.


Solution

  • There's nothing special about UniversalCRT_IncludePath to cl.exe.

    An MSBuild variable by that name (not the same as an environment variable or a shell variable) is used by the New-Project Wizard templates for Universal CRT to calculate the command-line to pass to cl.exe.

    Because you're invoking the compiler by hand, you should just add a /I switch with that directory and not bother with any environment variable that the compiler doesn't look for anyway.