vscode在Ubuntu中编写C ++错误“启动:程序<文件夹/file.out>不存在”

时间:2019-10-18 05:09:48

标签: c++ visual-studio-code

我在ubuntu中使用vscode编写和运行c ++代码。它一直工作到今天出现错误。每次我启动vscode并按ctrl + F5时,它都会在终端显示“执行任务:g ++”,但没有之后回应。

如果我重新启动调试器,它将显示“启动:程序不存在。

如果我在终端中使用g ++来构建.out文件,则vscode可以正常工作,因此我认为在构建时vscode中存在问题。

launch.json:

    {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/${fileBasenameNoExtension}.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "build",  
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

tasks.json:

    {
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": ["-g", "-o", "-std=c++11", "${file}", "${fileBasenameNoExtension}.out"]
        }
     ],
     "kind": "build",                
     "isDefault": true
}

0 个答案:

没有答案