使用调试器的Vscode错误

dl

尝试使用VSCODE调试c ++时,出现以下错误:

> Executing task: /usr/bin/g++ -g /home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch.json -o /home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch <

/usr/bin/ld:/home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch.json: file format not recognized; treating as linker script
/usr/bin/ld:/home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch.json:1: syntax error
collect2: error: ld returned 1 exit status
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

task.json

{
    "tasks": [
        {
            "type": "shell",
            "label": "g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "/usr/bin"
            }
        },
        {
            "type": "shell",
            "label": "g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "/usr/bin"
            },
            "problemMatcher": [
                "$gcc"
            ]
        }
    ],
    "version": "2.0.0"
}
dl

发现我的问题:

  • 这些文件(launch.json和tasks.json)是由VSCode为我生成的。
  • 但是,删除此行: "preLaunchTask": "g++ build active file",
  • 同时修改此行: "program":"${workspaceRoot}/TcpSocketClassTester/TcpSocketClassTester",
  • 最后删除文件:tasks.json(不需要)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何使用VSCode调试器调试Gunicorn工作进程?

使用VSCode调试器找不到节点进程

VSCode 上的调试器无法使用 Javascript

在VSCode的NodeJs调试器中使用“ esm”

无法使用 Gauge 框架启动 VSCode 调试器

RubyMine调试器错误

VSCode调试器条件断点

并行的多个VSCode调试器

VSCode Python调试器FileNotFoundError

调试器差异:VSCode /终端(Python)

Swift:如何使用调试器检测错误类型?

VSCode - 如何使用启动配置调试启动自己调试器的 Node 程序?

VSCode 调试器拒绝附加到没有错误或日志的节点进程?

VScode节点调试器抛出未捕获的错误:写入EPIPE

pydev调试器中的路径错误:

调试器可以抑制哪些错误?

Netbeans 8.1 C调试器错误?

调试器错误193 lazarus

当我想通过终端运行特定命令时,如何使用VScode的调试器?

与Phoenix和VSCode一起使用时,ElixirLS调试器意外停止

可以在脚本中(使用VSCode调试器)禁用python breakpoint()吗?

如何在由bazel构建的项目中使用vscode python调试器?

在Ubuntu中将VSCode与PHP(7)调试器一起使用

VSCode +调试器控制台。如何在调试器中更改文本的颜色?

使用Visual Studio IIS Express将VSCode调试器附加到.NET Core应用程序调试

VSCode Nodejs调试器是否不保存更改?

无法在VSCode中运行python3调试器

在 VScode 调试器中更改烧瓶运行端口

React Native Vscode TypeScript调试器步进非常慢