admin 管理员组

文章数量: 887021

不哔哔,切入正题,参考网络大神的方法,记录我的实践心得
1.配置过程:VSCode C/C++语言环境自动配置 半分钟部署环境 保证小白一看就会_哔哩哔哩_bilibili
2.工具箱:【一键】20秒配置VScodeC语言C++开发环境!免费开源_哔哩哔哩_bilibili
工具箱下载地址:Release AutoVsCEnv_WPF V1.994 · SDchao/AutoVsCEnv_WPF · GitHub
本地CSDN下载:VSCodeC++环境一键配置-其它文档类资源-CSDN下载
(如果有密码就是asd)

 部署自定义背景后,setting.json 部署参考文章末尾

使用前记得退出360,它似乎会阻拦环境变量的配置

最终结果:让大家拥有和我一样快乐的编译环境
        1.可以在vscode写C++文件
        2.C++在内置终端运行,不会生成碍眼的exe
        3.基础性的调试能力,断电测试能力
        4.非常舒服的快捷键,和内置资源结构管理

第一步:下载VSCode,部署内置插件

        按照视频做就好,我自己电脑的vscode安装路径
"C:\ASRC\VSCode\Microsoft VS Code\Code.exe"

 

第二步:个性化的快捷键部署

        推荐一下我自己喜欢的快捷键:
        1.  Alt + 1 3        左/右 切换  代码页
        2.  Alt + 2           关闭           代码页
        3.  Alt +  '+' /‘-’    放大/缩小   字体
        4.  Ctrl + '+'/'-'     放缩整个页面(包括字体)

 

第三步:启用工具箱,自动部署MINGW

 

 

 

 因为我已经配置好了就不用下一步了,第一个mingw64是配置mingw的路径
这个工具会帮你添加path,不需要你再去环境变量配置

工具运行后结果

 VSCode,打开test工作区,文件夹拖过去

第四步:json配置修复

这一步修复后,可以 1.文件自动保存 2.支持中文路径 3.终端内运行 且 不出现exe强迫症の快乐

run code 插件中json的修复

 

赋值一下代码,前面加上rm,后面加上.exe  给C和CPP都部署上去即可 

 把下面几个打钩都打上

第五步:编译环境再优化

浅浅的跑一下,没有问题

换个中文路径,再跑,也没有问题

 ACM文件夹中四个工作json的参考

c_cpp_properties

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/mingw64/include/*"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:/mingw64/bin/gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "targetArchitecture": "x86",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "miDebuggerPath": "C:/mingw64/bin/gdb.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "externalConsole": true,
            "preLaunchTask": "g++"
        }
    ]
}

setting.json

{
    "files.associations": {
        "algorithm": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "*.tcc": "cpp",
        "bitset": "cpp",
        "cctype": "cpp",
        "cfenv": "cpp",
        "charconv": "cpp",
        "chrono": "cpp",
        "cinttypes": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "codecvt": "cpp",
        "complex": "cpp",
        "condition_variable": "cpp",
        "csetjmp": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cuchar": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "forward_list": "cpp",
        "list": "cpp",
        "unordered_map": "cpp",
        "unordered_set": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "functional": "cpp",
        "iterator": "cpp",
        "map": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "random": "cpp",
        "ratio": "cpp",
        "regex": "cpp",
        "set": "cpp",
        "string": "cpp",
        "string_view": "cpp",
        "system_error": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "utility": "cpp",
        "fstream": "cpp",
        "future": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "scoped_allocator": "cpp",
        "shared_mutex": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "thread": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "valarray": "cpp",
        "Test_.C": "cpp",
        "queue": "cpp"
    }
}

tasks.json

{
  "version": "2.0.0",
  "command": "g++",
  "type": "shell",
  "presentation": {
    "echo": true,
    "reveal": "always",
    "focus": false,
    "panel": "shared",
    "showReuseMessage": true,
    "clear": false
  },
  "args": ["-m32","-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe"],
  "problemMatcher": {
    "owner": "cpp",
    "fileLocation": ["relative", "${workspaceRoot}"],
    "pattern": {
      "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
      "file": 1,
      "line": 2,
      "column": 3,
      "severity": 4,
      "message": 5
    }
  }
}

 调试测试,没用过,现学现卖

在这里结束,感谢网络上大佬分享的教程让我得到学习,我也愿意与你们一同分享实践过程!

workbench.colorCustomizations,然后打开settings.json设置文件(高亮选中部署

"workbench.colorCustomizations": {
        "editor.selectionHighlightBackground": "#288603",
        "editor.selectionBackground":"#288603",
        
    }

全局setting.json(已经部署background插件与相关主题)

{
    "workbench.iconTheme": "vscode-icons",
    "files.encoding": "gbk",
    "files.autoSave": "afterDelay",
    "bracket-pair-colorizer-2.depreciation-notice": false,
    "explorer.confirmDelete": false,
    "code-runner.executorMap": {
        "javascript": "node",
        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
        "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt && rm $dir$fileNameWithoutExt.exe",
        "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt && rm $dir$fileNameWithoutExt.exe",
        "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "php": "php",
        "python": "python -u",
        "perl": "perl",
        "perl6": "perl6",
        "ruby": "ruby",
        "go": "go run",
        "lua": "lua",
        "groovy": "groovy",
        "powershell": "powershell -ExecutionPolicy ByPass -File",
        "bat": "cmd /c",
        "shellscript": "bash",
        "fsharp": "fsi",
        "csharp": "scriptcs",
        "vbscript": "cscript //Nologo",
        "typescript": "ts-node",
        "coffeescript": "coffee",
        "scala": "scala",
        "swift": "swift",
        "julia": "julia",
        "crystal": "crystal",
        "ocaml": "ocaml",
        "r": "Rscript",
        "applescript": "osascript",
        "clojure": "lein exec",
        "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
        "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
        "racket": "racket",
        "scheme": "csi -script",
        "ahk": "autohotkey",
        "autoit": "autoit3",
        "dart": "dart",
        "pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
        "d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
        "haskell": "runhaskell",
        "nim": "nim compile --verbosity:0 --hints:off --run",
        "lisp": "sbcl --script",
        "kit": "kitc --run",
        "v": "v run",
        "sass": "sass --style expanded",
        "scss": "scss --style expanded",
        "less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
        "FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
    },
    "code-runner.runInTerminal": true,
    "code-runner.saveFileBeforeRun": true,
    "code-runner.saveAllFilesBeforeRun": true,
    "editor.unicodeHighlight.allowedLocales": {
        "zh-hant": true
    },
    "workbench.colorTheme": "escook Dark",
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "editor.fontSize": 18,
    "explorer.confirmDragAndDrop": false,
    "workbench.colorCustomizations": {
        "editor.selectionHighlightBackground": "#288603",
        "editor.selectionBackground": "#288603",
    },
    "vsicons.dontShowNewVersionMessage": true,
    "[cpp]": {
        "editor.defaultFormatter": "ms-vscode.cpptools"
    },
    "workbench.layoutControl.enabled": false,
    "background.enabled": true,//增强部署,删除后恢复
    "background.useDefault": false,//增强部署,删除后恢复
    "background.customImages": [//部署的多张图片,会在分屏代码时候轮番上阵,据说最多部署3张
        "file:///C:/计算机核心/PC Res/长期文件/壁纸库/back4.png"
        "file:///C:/计算机核心/PC Res/长期文件/壁纸库/back3.png"
        "file:///C:/计算机核心/PC Res/长期文件/壁纸库/back2.png"//同样是增强部署
    ],
    "background.style": {
    
    
        "content": "''",
        "pointer-events": "none",
        "position": "absolute",
        "z-index": "99999",
        "width": "100%",
        "height": "100%",
        "background-position": "0% 30%",
        "background-repeat": "no-repeat",
        "opacity": 1
    },
    "workbench.startupEditor": "none",
    "background.fullscreen": {




        "image": "",
        "opacity": 0.91,
        "size": "cover"
    },
    "workbench.statusBar.visible": false,
    "open-in-browser.default": "firefox",
    "workbench.activityBar.visible": false
}

部分插件推荐

 

 

win + ;    调出emoji表情包

本文标签: 重装系统 环境 vscode 这档事