MSVC 环境变量未显示在不同的终端中
MSVC environment variables not showing up in different terminals
我正在使用Haxe的HXCPP生成C++代码并使用Visual Studio 2010 Express Edition Microsoft编译它。我正在遵循本指南,它要求您运行"c:Program Files (x86)Microsoft Visual Studio 10.0Common7Toolsvsvars32.bat"
以便cl.exe
(编译器)在您的构建路径中。
这确实允许我运行 cl.exe,但只能在该终端中运行。如果我尝试从另一个终端或在我的 IDE 中运行它,它会失败(崇高文本 2)。
我想出了一个解决方法:手动将变量值从终端复制+粘贴到 GUI 环境变量编辑器。
一定有更好的方法。我错过了什么?
构建.hxml
-main Test
-cpp bin
测试.hx
class Test {
static function main() {
trace("Hello World!");
}
}
构建时出现错误消息
link.exe -out:Test.exe -nologo -machine:x86 -libpath:lib user32.lib -libpath:e:/VS8/PlatformSDK/Lib @all_objs
LINK : fatal error LNK1181: cannot open input file 'user32.lib'
Called from ? line 1
Called from BuildTool.hx line 1246
Called from BuildTool.hx line 554
Called from BuildTool.hx line 591
Called from BuildTool.hx line 710
Called from BuildTool.hx line 796
Called from BuildTool.hx line 285
您必须为已打开的每个终端(环境)运行以下命令:
c:Program Files (x86)Microsoft Visual Studio 10.0Common7Toolsvsvars32.bat
它定义的环境变量都是局部的。
相关文章:
- 枚举环境变量的惯用C++14/C++17方法
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- 定义C++新的环境变量并在 bat 文件中使用它
- docker 构建失败:无法设置环境变量
- 如何在不传递命令行参数的情况下在 c++ 中设置环境变量
- C++环境变量
- 在编译时为运行时设置环境变量
- 如何使用可视化代码和平台IO将环境变量注入CPP文件?
- 访问 PlatformIO 中的外部环境变量
- WSL 看不到环境变量
- 如何在提升构建中设置环境变量以进行提升单元测试框架?
- 注册 TBB 的环境变量
- 如何设置Qt应用程序以使用类Unix系统的实际环境变量?
- CMake 看不到SDL2_PATH环境变量 (Windows)
- 跨语言共享环境变量
- 什么是运行英特尔线程构建模块的 XCode 8 环境变量
- 在运行时将更改的环境变量应用于 QApplication
- 在C++程序中找不到环境变量 UID
- Visual Studio 2017 C++,如何定义一个"环境变量"'Additional Library Directory'?
- MSVC 环境变量未显示在不同的终端中