gpt4 book ai didi

c++ - Bazel - token 附近出现意外错误

转载 作者:行者123 更新时间:2023-11-28 04:54:05 24 4
gpt4 key购买 nike

我正在尝试使用 mysysbazel 来设置我的 bazel 环境。按照此 website 中的说明进行操作,在我必须为 Visual Studio 设置环境变量之前,我已经做得很好了。

我尝试使用下面的代码将 visual studio 设置为环境变量

export BAZEL_VC=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC

但是我得到了这个错误:

-bash: syntax error near unexpected token `('

阅读错误,我的猜测是 ( token 未被接受。一种解决方案是更改目录名称。但我宁愿不这样做。我希望有人可以提供更多 C++ 答案。

最佳答案

在Bash中需要引用环境变量值:

export BAZEL_VC="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC"

不过,我建议在 Windows 命令提示符 (cmd.exe) 中使用 Bazel,而不是 MSYS Bash。 (文档似乎建议从 MSYS 运行 Bazel?)

在 Bazel 0.5.0 之前 Bazel 确实需要从 MSYS shell 运行,但它在 cmd.exe 中运行了很长时间。

如果您在 cmd.exe 中使用 Bazel,并且想要设置环境变量,那么您绝不能引用该值:

set BAZEL_VC=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC

因为 cmd.exe 不会像 Bash 那样删除(也不需要)引号。

关于c++ - Bazel - token 附近出现意外错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47547518/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com