简体   繁体   English

Building Boost-找不到windows.h

[英]Building Boost - can't find windows.h

I'm trying to build boost on windows 7 64-bits. 我正在尝试在Windows 7 64位上构建增强功能。 Running bootstrap gives 运行引导程序给

execnt.c(29) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory execnt.c(29):致命错误C1083:无法打开包含文件:'windows.h':没有此类文件或目录

and some others. 和其他一些。 I have visual studio 9.0 and the places where I have windows.h is in 我有Visual Studio 9.0,还有安装windows.h的地方

  • C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v5.0\\Include**W**indows.h, with capital W C:\\ Program Files(x86)\\ Microsoft SDKs \\ Windows \\ v5.0 \\ Include ** W ** indows.h,大写字母W
  • C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Include**W**indows.h C:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v6.0A \\ Include ** W ** indows.h
  • C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\SmartDevices\\SDK\\Smartphone2003\\Include\\windows.h C:\\ Program Files(x86)\\ Microsoft Visual Studio 9.0 \\ SmartDevices \\ SDK \\ Smartphone2003 \\ Include \\ windows.h

I have the SDK installed and even fully reinstalled Visual studio. 我已经安装了SDK,甚至完全重新安装了Visual Studio。 Any way I can fix this? 我能解决这个问题吗?

  • Small update : I installed Visual C++ 2010 express and from the IDE I can include and the test project compiles just fine, but when I use the prompt NO projects can find the header 小更新 :我安装了Visual C ++ 2010 Express,可以从IDE中包含它,并且测试项目可以正常编译,但是当我使用提示时,没有项目可以找到标头

Try running the boost build from a VS console rather than trying to run 'cmd'. 尝试从VS控制台运行boost版本,而不是尝试运行“ cmd”。 It's probably somewhere in the start menu entry for VS (used to be anyway). 它可能在VS的开始菜单项中的某个位置(过去总是如此)。 It used to also be available from VS itself under tools, but I think they removed it there. 它过去也可以从VS本身的工具中获得,但我认为他们已将其删除。

This version is just cmd, but it runs a batch script that sets a bunch of very important environment variables. 这个版本只是cmd,但是它运行一个批处理脚本,该脚本设置了一堆非常重要的环境变量。

For future reference of anyone looking for the same error 供以后寻找相同错误的人参考

I have installed visual studio without registry edition permission, so I had none of the environment variables set, those that boost libraries / libxml2 et al look for when calling the cl compiler 我已经安装了Visual Studio,但未获得注册表版本的许可,因此我没有设置任何环境变量,那些提升库/ libxml2等的环境变量在调用cl编译器时会寻找

Giving myself permission to edit the registry and uninstalling/reinstalling all visual studio related programs solved it 授予自己编辑注册表的权限,然后卸载/重新安装所有与Visual Studio相关的程序,即可解决该问题

Edit %VS90COMNTOOLS%vsvars32.bat with administrator privileges any way you like, eg. 使用管理员权限以任何方式编辑%VS90COMNTOOLS%vsvars32.bat,例如。

runas /user:Administrator "notepad %VS90COMNTOOLS%vsvars32.bat"

Find the section 查找部分

:GetWindowsSdkDirHelper
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO (
    if "%%i"=="CurrentInstallFolder" (

Change it to 将其更改为

:GetWindowsSdkDirHelper
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0a" /v "InstallationFolder"') DO (
    if "%%i"=="InstallationFolder" (

When you install a newer version of the Windows SDK, it updates HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\CurrentInstallFolder to point to the newer version. 当您安装Windows SDK的较新版本时,它将更新HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ Microsoft SDKs \\ Windows \\ CurrentInstallFolder以指向较新版本。

Unfortunately, the batch file that Visual Studio 2008 uses to set its paths uses this registry key to identify the location of the Windows SDK, so instead of pointing at the version of the Windows SDK that works with VS2008 (6.0a), it points to the the latest version to be installed. 不幸的是,Visual Studio 2008用来设置其路径的批处理文件使用此注册表项来标识Windows SDK的位置,因此它不是指向与VS2008(6.0a)兼容的Windows SDK版本,而是指向要安装的最新版本。

Editing the registry is one option. 编辑注册表是一种选择。 A better option is to change the batch file so that it gets the right path from the registry, as above. 更好的选择是更改批处理文件,以便它从注册表中获取正确的路径,如上所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM