微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

VScode:该进程无法访问该文件,因为它正在被另一个进程使用 At line:1 char:1

如何解决VScode:该进程无法访问该文件,因为它正在被另一个进程使用 At line:1 char:1


我正在尝试在 VSCode 中设置 C++ 环境, 当我尝试运行我的 helloworld 文件时出现此错误

程序“helloworld.exe”无法运行:进程无法访问文件 因为它正在被另一个进程使用在 line:1 char:1

我的tasks.json:

{
    "version" : "2.0.0","tasks" :[
                    {
                      "type" : "cppbuild","label" : "echo","command" : "C:\\MinGW\\bin\\cpp.exe","args" : [
                          "-g ","-o","${workspaceFolder}\\helloworld.exe",],"options" : {
                          "cwd" : "${workspaceFolder}"
                      },"problemmatcher" : ["$gcc"],"group" : {

                          "kind" : "build","isDefault" : true
                      },"detail" : "compiler: C:\\MinGW\\bin\\cpp.exe"

                    }
                ]
}

当我尝试调试我的程序时收到错误消息“没有这样的文件或目录”。

执行任务:g++ -g helloworld.cpp g++.exe:错误:helloworld.cpp:没有那个文件或目录 g++.exe:致命错误:没有输入文件 编译终止。 终端进程“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command g++ -g helloworld.cpp”以退出代码:1.

我的launch.json:

{
    "version": "0.2.0","configurations": [
        {
            "name": "(gdb) Launch","type": "cppdbg","request": "launch","program": "${workspaceFolder}/helloworld.exe","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe","setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
                }
            ],"prelaunchTask": "echo"
        }
    ]
}    

请帮助我摆脱这个错误,并帮助我在 vscode 上运行我的第一个 C++ 程序:(

谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。