// https://code.visualstudio.com/docs/editor/tasks { "version": "2.0.0", "tasks": [ { "label": "Compile", // 任务名称,与launch.json的preLaunchTask相对应 "command": "g++", // 要使用的编译器,C++用g++ "args": [ "${file}", "-o", // 指定输出文件名,不加该参数则默认输出a.exe,Linux下默认a.out "${fileDirname}\\${fileBasenameNoExtension}.exe", "-g", // 生成和调试有关的信息 "-Wall", // 开启额外警告 "-static-libgcc", // 静态链接libgcc,一般都会加上 "-fexec-charset=GBK", // 生成的程序使用GBK编码,不加这一条会导致Win下输出中文乱码 "-std=c++11", // C++最新标准为c++17,或根据自己的需要进行修改 ], // 编译的命令,其实相当于VSC帮你在终端中输了这些东西 "type": "process", // process是vsc把预定义变量和转义解析后直接全部传给command;shell相当于先打开shell再输入命令,所以args还会经过shell再解析一遍 "group": { "kind": "build", "isDefault": true // 不为true时ctrl shift B就要手动选择了 }, "presentation": { "echo": true, "reveal": "always", // 执行任务时是否跳转到终端面板,可以为always,silent,never。具体参见VSC的文档 "focus": false, // 设为true后可以使执行task时焦点聚集在终端,但对编译C/C++来说,设为true没有意义 "panel": "shared" // 不同的文件的编译信息共享一个终端面板 }, }, { "label": "commit gitee", "type": "shell", "command": "D:\\KeCheng\\一键推拉.cmd", "group": { "kind": "build", "isDefault": true }, } ] }