VS Code Customizing Command Argument

Viewed 21

I have been trying to customize the argument command for compiling the c file in vs code but I could not figure it out.

I would like to get warnings with -Wall and use the C99 standard with -std=c99 and I wanted to customize my argument like:

gcc -Wall -std=c99 hello.c -o hello

I guess I should add the argument in the tasks.json file but it is really confusing.

This is my tasks.json file.

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-Wall",
                "std=c99",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
0 Answers
Related