? ? 最近,迷上了VsCode這款編輯器,被它的顏值完全吸引到了,由于最近某杯的算法比賽開始了,所以我最近想用VsCode去編輯運(yùn)行C/C++,苦于找了好多的方法,最后終于實(shí)現(xiàn)了。現(xiàn)在就來記錄一下整個配置的過程:
? ? 1.首先需要下載VsCode(滑稽??),并下載所需要的插件。


? ? 2.在電腦上新建一個文件夾(作為C/C++的運(yùn)行文件夾,我就建在Desktop上了)如下圖,很簡單。

3.打開VsCode,打開新建的C/C++文件夾。依然很簡單。(Mac快捷鍵command+O,打開文件)

4.開始新建一個.cpp文件。(新建快捷鍵 command+N)

5.配置3個文件。
(1)c_cpp_properties.json

{
? ? "configurations": [
? ? ? ? {
? ? ? ? ? ? "name": "Mac",
? ? ? ? ? ? "includePath": [
? ? ? ? ? ? ? ? "${workspaceFolder}/**"
? ? ? ? ? ? ],
? ? ? ? ? ? "defines": [],
? ? ? ? ? ? "macFrameworkPath": [
? ? ? ? ? ? ? ? "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks"
? ? ? ? ? ? ],
? ? ? ? ? ? "compilerPath": "/usr/bin/clang",
? ? ? ? ? ? "cStandard": "c11",
? ? ? ? ? ? "cppStandard": "c++17",
? ? ? ? ? ? "intelliSenseMode": "clang-x64"
? ? ? ? }
? ? ],
? ? "version": 4
}
(2)launch.json

{
? ? // Use IntelliSense to learn about possible attributes.
? ? // Hover to view descriptions of existing attributes.
? ? // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
? ? "version": "0.2.0",
? ? "configurations": [
? ? ? ? {
? ? ? ? ? ? "name": "c/c++ Launch",
? ? ? ? ? ? "type": "cppdbg",
? ? ? ? ? ? "request": "launch",
? ? ? ? ? ? "program": "${workspaceFolder}/a.out",
? ? ? ? ? ? "args": [],
? ? ? ? ? ? "stopAtEntry": false,
? ? ? ? ? ? "cwd": "${workspaceFolder}",
? ? ? ? ? ? "environment": [],
? ? ? ? ? ? "externalConsole": true,
? ? ? ? ? ? "MIMode": "lldb",
? ? ? ? ? ? "preLaunchTask":"c++"
? ? ? ? }
? ? ]
}
(3)tasks.json

{
? ? // See https://go.microsoft.com/fwlink/?LinkId=733558
? ? // for the documentation about the tasks.json format
? ? "version": "2.0.0",
? ? "tasks": [
? ? ? ? {
? ? ? ? ? ? "label": "c++",
? ? ? ? ? ? "command": "clang++",
? ? ? ? ? ? "type": "shell",
? ? ? ? ? ? "args": [
? ? ? ? ? ? ? ? "${file}",
? ? ? ? ? ? ? ? "-std=c++11",
? ? ? ? ? ? ? ? "-g"
? ? ? ? ? ? ],
? ? ? ? ? ? "presentation": {
? ? ? ? ? ? ? ? "echo": true,
? ? ? ? ? ? ? ? "reveal": "always",
? ? ? ? ? ? ? ? "focus": false,
? ? ? ? ? ? ? ? "panel": "shared"
? ? ? ? ? ? },
? ? ? ? ? ? "group": {
? ? ? ? ? ? ? ? "kind": "build",
? ? ? ? ? ? ? ? "isDefault": true
? ? ? ? ? ? }
? ? ? ? }
? ? ]
}
然后就可以運(yùn)行已經(jīng)寫好的jianshu.cpp文件了。
