gcc 匹配tasks.json上的文件.c以进行编译

kjthegm6  于 2022-11-30  发布在  其他
关注(0)|答案(1)|浏览(202)

我在vscode上使用Microsoft扩展来编译C,问题是,使用一个文件.c,可以,但当我包含一些lib(如conio.c)时,我需要手动告诉编译此文件,将文件名放在tasks.json中,我想自动完成此操作,但我无法在tasks.json中添加任何“模式”,而且我不知道.json是否运行regex,提前感谢!基本上我想匹配所有我在主程序中使用的.c。

{
  "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"
}
0x6upsns

0x6upsns1#

{
  "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"
}

相关问题