我在 VS Code 中使用 Code Runner 扩展来运行 C++ 代码,并且它使用了错误的终端命令来执行此操作。我在 VS Code 和 Windows 10 中使用 git-bash。
这是终端中的命令:
Douglas@LAPTOP-6BSNLLDB MINGW64 /c/path (master)
$ cd "c:\path\" && g++ HelloWorld.cpp -o HelloWorld && "c:\path\"HelloWorld
bash: cd: c:\path" && g++ HelloWorld.cpp -o HelloWorld && c:path"HelloWorld: No such file or directory
如您所见,它正在使用cd
并且g++
正确,但是实际运行.exe
文件的命令是错误的。不应该"c:\path\HellowWorld.exe"
吗?
我怎样才能改变这个?它可以与 python 一起正常工作。
如果不能,如何在 VS Code 中运行 C++ 代码?