Home > Net >  match files .c on tasks.json to compile
match files .c on tasks.json to compile

Time:11-30

i'm using the microsoft extension on vscode to compile C, the problem is, with one file .c, ok, but when i include some lib, like conio.c, i need to tell manually to compile this file too putting the name of the file in the tasks.json, i want to do this automatically, but i can't add any "pattern" in tasks.json, and i don't know if .json runs regex, thanks in advance! Basically i want to match all .c that i'm using in the main program.

    {
  "tasks": [
    {
      "type": "cppbuild",
      "label": "C/C  : gcc.exe arquivo de build ativo",
      "command": "gcc",
      "args": [
        "-fdiagnostics-color=always",
        "-g",
        "${file}"  ---add name of file to here compile---,
        "-o",
        "${fileDirname}\\${fileBasenameNoExtension}.exe"
      ],
      "options": {
        "cwd": "${fileDirname}"
      },
      "problemMatcher": [
        "$gcc"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Tarefa gerada pelo Depurador."
    }
  ],
  "version": "2.0.0"
}

CodePudding user response:

{
  "tasks": [
    {
      "type": "cppbuild",
      "label": "C/C  : gcc.exe arquivo de build ativo",
      "command": "gcc",
      "args": [
        "-fdiagnostics-color=always",
        "-g",
        "${fileDirname}\\**.c",
        "${fileDirname}\\**.h",
        "-o",
        "${fileDirname}\\bin\\${fileBasenameNoExtension}.exe"
      ],
      "options": {
        "cwd": "${fileDirname}"
      },
      "problemMatcher": [
        "$gcc"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Tarefa gerada pelo Depurador."
    }
  ],
  "version": "2.0.0"
}

  • Related