代码之家  ›  专栏  ›  技术社区  ›  Or Yaacov

c如何在vscode ubuntu上使用gcc进行编译和调试

  •  -1
  • Or Yaacov  · 技术社区  · 6 年前

    我已经找到了一些用gcc编译器调试c的不同方法,但是我希望在默认情况下启用调试。有没有办法我可以在我的设置 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": "(gdb) Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceFolder}/a.out",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": true,
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            }
        ]
    }
    
    1 回复  |  直到 6 年前
        1
  •  3
  •   S.S. Anne    6 年前

    将这些添加到cflags中: -gdwarf-4 -g3

    为此,请运行以下命令:

    export CFLAGS="${CFLAGS} -gdwarf-4 -g3"
    

    this 链接以获取更多信息和 this 运行命令的链接 launch.json