From ebbf118aa2ba1b1679393107db322c5b38067edf Mon Sep 17 00:00:00 2001 From: iridiumR Date: Fri, 3 Dec 2021 00:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 8 +++---- .vscode/tasks.json | 45 ++++++++++++++++------------------------ workspace.code-workspace | 3 ++- 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index d361b26..b4b192d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,20 +1,18 @@ { "version": "0.2.0", - "label": "Compile", "configurations": [ { "name": "g++.exe", - "label": "Compile", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, - "cwd": "C:/Project/mingw64/bin", + "cwd": "C:/Project/mingw64/bin",//自己的编译器路径,自行修改 "environment": [], "externalConsole": false, "MIMode": "gdb", - "miDebuggerPath": "C:\\Project\\mingw64\\bin\\gdb.exe", + "miDebuggerPath": "C:\\Project\\mingw64\\bin\\gdb.exe",//自己的gdb路径,自行修改 "setupCommands": [ { "description": "gdb", @@ -22,7 +20,7 @@ "ignoreFailures": true } ], - "preLaunchTask": "Compile" + "preLaunchTask": "Compile"//可以随意更改,保证与tasks.json的label相同 } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5ddc66e..8146f19 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,33 +1,24 @@ -// https://code.visualstudio.com/docs/editor/tasks { - "version": "2.0.0", "tasks": [ { - "label": "Compile", // 任务名称,与launch.json的preLaunchTask相对应 - "command": "clang++", // 要使用的编译器 + "type": "cppbuild", + "label": "Compile",//可以随意更改,保证与launch.json的preLaunchTask相同 + "command": "g++", "args": [ - "${file}", - "-o", // 指定输出文件名,不加该参数则默认输出a.exe - "${fileDirname}/${fileBasenameNoExtension}.exe", - "-g", // 生成和调试有关的信息 - "-Wall", // 开启额外警告 - "-static-libgcc", // 静态链接 - "-fcolor-diagnostics", - "--target=x86_64-w64-mingw", // 默认target为msvc,不加这一条就会找不到头文件 - "-std=c++17" // C语言最新标准为c11,或根据自己的需要进行修改 - ], // 编译命令参数 - "type": "shell", - "group": { - "kind": "build", - "isDefault": true // 设为false可做到一个tasks.json配置多个编译指令,需要自己修改本文件,我这里不多提 + "${fileDirname}\\*.cpp",//编译所有文件,根据自己需要更改 + "-g",//一定要加这个参数,不然没法加断点 + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "C:/Project/mingw64/bin"//自己的编译器路径,自行修改 }, - "presentation": { - "echo": true, - "reveal": "always", // 在“终端”中显示编译信息的策略,可以为always,silent,never。具体参见VSC的文档 - "focus": false, // 设为true后可以使执行task时焦点聚集在终端,但对编译c和c++来说,设为true没有意义 - "panel": "shared" // 不同的文件的编译信息共享一个终端面板 - } - // "problemMatcher":"$gcc" // 如果你不使用clang,去掉前面的注释符,并在上一条之后加个逗号。照着我的教程做的不需要改(也可以把这行删去) + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "编译器: C:/Project/mingw64/bin/g++.exe" } - ] -} + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/workspace.code-workspace b/workspace.code-workspace index 0b3a9e3..45474dc 100644 --- a/workspace.code-workspace +++ b/workspace.code-workspace @@ -13,7 +13,8 @@ "sstream": "cpp", "stdexcept": "cpp", "streambuf": "cpp", - "istream": "cpp" + "istream": "cpp", + "array": "cpp" } } } \ No newline at end of file