【问题解决】vs2013 command prompt错误:cannot determine the location of the vs common tools folder

本文介绍了解决VS2013在编译配置Boost库时出现的错误,具体为找不到vscommontools文件夹的问题。通过调整系统环境变量Path,将C:WindowsSystem32重新添加进去,成功解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题缘由:

因项目需要,须使用boost库。编译,配置boost库的流程参照的是boost在windows下的编译及配置

在编译和配置过程中,需要使用到vs2013的command prompt,遇到如下问题:

cannot determine the location of the vs common tools folder

-------------

问题解决:

在网上查找资料,找到如下几篇相关的博文/帖子

stackoveflow: vs2010 command prompt gives error

csdn: vs2013错误解决方法

vs2012无法使用命令行提示符

主要原因是

“the bat uses de reg command and it searches that in the PATH system variable. Somehow you have managed to get "C:\Windows\System32" out of the PATH variable”

只要将"C:\Windows\System32" 重新添加到系统环境变量下的path中去,即解决上述问题。

### 安装 Visual Studio x64 Native Tools Command Prompt 为了安装并配置 Visual Studio 的 x64 Native Tools Command Prompt,需确保已正确安装 Visual Studio 并选择了必要的工作负载。通常情况下,该命令提示符随 Visual Studio 安装程序一同安装。 对于已经完成 Visual Studio 安装的情况,可以通过执行特定的批处理脚本来启动 x64 Native Tools Command Prompt: ```batch "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 ``` 上述路径适用于 Visual Studio 2019 社区版;如果使用其他版本,则应调整 `2019` 和 `Community` 部分以匹配实际安装情况[^2]。 另一种方法是利用 Microsoft 提供的小型实用工具 `vswhere.exe` 来动态定位 Visual Studio 的安装位置以及相应的环境设置文件。此方法特别适合于自动化构建过程中的场景,在 Windows 批处理文件中实现如下操作: ```batch @echo off setlocal for /f "usebackq tokens=*" %%i in (`"%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( set InstallDir=%%i ) call "%InstallDir%\Common7\Tools\VsDevCmd.bat" -arch=x64 ``` 这段代码会自动检测最新版本的 Visual Studio 及其对应的 x64 开发人员命令行工具,并对其进行初始化[^3]。 通过以上两种途径之一即可成功开启 x64 Native Tools Command Prompt,从而方便地进行基于 MSVC 编译器的各种开发活动。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值