如何从VSCode的终端窗口以外的窗口编译和调试C程序?

时间:2019-03-09 19:53:29

标签: visual-studio-code

我是VSCode的新手。我创建了一个helloworld C程序mymain.c,但是除了从终端窗口中输入gccgdb命令之外,找不到从VSCode对其进行编译和调试的方法。我想知道如何从VSCode的终端窗口之外进行编译和调试?

如果我必须使用构建工具,我想知道VSCode是否可以简化创建和运行Makefile?

谢谢。

我的.vscode/c_cpp_properties.json是默认

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

,默认为.vscode/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": "enter program name, for example ${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
                }
            ]
        }
    ]
}

0 个答案:

没有答案