简体   繁体   English

Git Bash构建无法在VS Code中从终端运行

[英]Git Bash build doesn't work from terminal in VS Code

I have a fresh install of Windows 10 - 64bit 我重新安装了Windows 10-64位

  • MinGW - To install gcc MinGW-安装gcc
  • Git 2.15.1.4 (64 bit ) Git 2.15.1.4(64位)
  • VSCode 1.20 (64 bit) VSCode 1.20(64位)

The command I am using is: 我正在使用的命令是:

g++ --version

It doesn't work from using the terminal inside VSCode. 使用VSCode内的终端无法正常工作。

However running bash window outside of VSCode, it works fine. 但是在VSCode之外运行bash窗口,效果很好。 Anybody know any suggestions on how to fix it? 有人知道如何解决它的任何建议吗?

GitBash Terminal GitBash终端

GitBash In VSCode VSCode中的GitBash

Thanks, Ciaran 谢谢,西亚兰

Compare the PATH from your bash outside VSCode: 比较来自VSCode之外bash的PATH:

echo $PATH

And make sure to get the same PATH in your bash within VSCode: 并确保在VSCode中的bash中获得相同的PATH:

export PATH=/the/path/you/see/in/the/previous/step

Once this test is working, check in your VSCode bash where your $HOME is, and modify your ~/.bashrc in order to set that PATH, as advised in Microsoft/vscode issue 24989 . 测试成功后,请在$ Code所在的VSCode bash中签入,并按照Microsoft / vscode问题24989中的建议修改~/.bashrc来设置该PATH。


The OP adds in the comments : OP 在注释中添加:

after leaving and coming back to it the next day. 离开后,第二天再回来。 It is now working.... Must of needed a restart or something? 它现在正在工作。...是否需要重新启动?

This is expected: if the PATH was modified first, the existing process did not inherit immediately that change. 这是可以预期的:如果先修改PATH,则现有进程不会立即继承该更改。 Closing/re-oppening everything would work however. 关闭/重新装箱一切正常。

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

相关问题 为什么我的集成VS Code Bash终端不使用bash着色? - Why doesn't my integrated VS Code Bash terminal use bash coloring? 谁能解释Git Bash和VS Code Integrated Terminal(bash)之间的区别? - Can anybody explain the difference between Git Bash and VS Code Integrated Terminal (bash)? Windows上的git bash:交互模式不起作用 - git bash on windows: interactive mode doesn't work VS Code Windows 中不存在终端 shell 路径“..\\..\\..\\vsCode\\git\\bin\\bash.exe” - The terminal shell path "..\..\..\vsCode\git\bin\bash.exe" does not exist in VS Code Windows 在Ubuntu终端中工作的代码,在Windows Eclipse中不工作 - working code in Ubuntu terminal, doesn't work in Windows Eclipse 如何从 Git Bash 终端打印? - How to print from Git Bash terminal? Windows Exporer中的Git上下文菜单具有“ git bash”选项,但它不起作用 - Git context menu in Windows Exporer has a “git bash” option but it doesn't work SourceTree 自定义操作不起作用,但通过 Git 终端窗口起作用 - SourceTree custom action doesn't work but works through Git terminal window 为什么此代码位在 clion 中有效但在 VS 中无效 - Why does this code bit work in clion but doesn't in VS VS c ++删除子项不起作用! 错误代码0 - VS c++ Deleting subkey doesn't work! Error code 0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM