栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

“21天好习惯”第一期-10

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

“21天好习惯”第一期-10

vscode 个性化配置工作区

在vscode - setting.json中加入如下代码

    "workbench.colorCustomizations": {
    //菜单栏
    "titleBar.activeBackground":"#f2f2f2",
    "titleBar.border":"#c0c0c0",
    //活动栏
    "activityBar.background": "#f2f2f2",
    "activityBar.foreground": "#000000",
    "activityBar.border":"#c0c0c0",
    //资源管理器
    "sideBar.background": "#ffffff",
    "sideBar.border":"#c0c0c0",
    "sideBarSectionHeader.background":"#f2f2f2",
    //文件列表
    "list.hoverBackground": "#1a7dc4",
    "list.hoverForeground":"#ffffff",
    //文件页签
    "tab.hoverBackground":"#dadada",
    "tab.inactiveForeground":"#000000",
    "tab.inactiveBackground": "#f2f2f2",
    "tab.activeBorder":"#1a7dc4",
    "tab.activeBackground":"#fafafa",
    //编辑区
    "editor.background":"#ffffff",
    "editor.foreground":"#000000",
    "editorLineNumber.foreground":"#999999",
    "editorCursor.foreground": "#000000",
    "editor.selectionHighlightBackground":"#fffae3",
    "editor.selectionForeground":"#fff",
    "editor.selectionBackground":"#f8de6bc2",
    "editor.wordHighlightBackground":"#fffae3",
    
    //状态栏
    "statusBar.background": "#f2f2f2",
    "statusBar.foreground": "#000000",
    "statusBar.border":"#c0c0c0",
    "panel.border":"#c0c0c0",
    "panelTitle.activeBorder":"#1a7dc4",
}
VSCode常用json
台式机


```json
{
    "code-runner.runInTerminal": true,
    "C_Cpp.clang_format_fallbackStyle": "{basedOnStyle: Google, IndentWidth: 4}",
    "C_Cpp.clang_format_style": "{basedOnStyle: Google, IndentWidth: 4}",
    "window.zoomLevel": 1,
    "editor.fontFamily": "'Droid Sans Mono','Fira code', Consolas, 'Courier New', CamingoCode, monospace",
    "editor.fontSize": 18,
    "editor.largeFileOptimizations": false,
    "files.autoGuessEncoding": true,
    "editor.suggestSelection": "first",
    "C_Cpp.errorSquiggles": "Enabled",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "java.home": "C:\Program Files\jdk-14.0.2",
    "java.help.firstView": "gettingStarted",
    "java.semanticHighlighting.enabled": true,
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "python.languageServer": "Pylance",
    "workbench.iconTheme": "material-icon-theme",
    "workbench.colorTheme": "Quiet Light",
    "vsicons.dontShowNewVersionMessage": true,
    "editor.minimap.enabled": false,
    "editor.codeActionsOnSave": null
}

笔记本

{
    "breadcrumbs.enabled": true,
    "workbench.iconTheme": "vs-minimal",
    "code-runner.saveFileBeforeRun": true,
    "code-runner.runInTerminal": true,
    "editor.renderWhitespace": "none",
    "kite.showWelcomeNotificationOnStartup": false,
    "C_Cpp.clang_format_style": "{basedOnStyle: Google, IndentWidth: 4}",
    "C_Cpp.clang_format_fallbackStyle": "{basedOnStyle: Google, IndentWidth: 4}",
    "window.zoomLevel": 1,
    "explorer./confirm/iDragAndDrop": false,
    "workbench.colorTheme": "Quiet Light",
    "editor.minimap.enabled": false,
    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features"
    },
    "files.autoGuessEncoding": true,
    "editor.fontFamily": "'Droid Sans Mono','Fira Code',Consolas, 'Courier New', monospace",
    "[javascript]": {
        "editor.defaultFormatter": "lonefy.vscode-JS-CSS-HTML-formatter"
    },
    "liveServer.settings.donotShowInfoMsg": true,
    "[json]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
    "[sql]": {
        "editor.defaultFormatter": "adpyke.vscode-sql-formatter"
    },
    "[markdown]": {
        "editor.quickSuggestions": true
    },
    "workbench.editorAssociations": [],
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "python.languageServer": "Microsoft"
}

Linux 本

{
    "window.zoomLevel": 2,
    "files.autoGuessEncoding": true,
    "code-runner.runInTerminal": true,
    "C_Cpp.clang_format_fallbackStyle": "{basedOnStyle: Google , IndentWidth : 4}",
    "C_Cpp.clang_format_style": "{basedOnStyle: Google , IndentWidth : 4}",
    "code-runner.executorMap": {

        "javascript": "node",
        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
        "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "php": "php",
        "python": "python3 -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"
    },
    "workbench.colorTheme": "Quiet Light",
    "workbench.iconTheme": "vscode-icons",
    "explorer./confirm/iDelete": false,
    "workbench.statusBar.visible": true,
    "editor.minimap.enabled": false,
    "workbench.sideBar.location": "left",
    "workbench.activityBar.visible": true,
    "editor.renderControlCharacters": true,
    "editor.codeActionsOnSave": null
}
VSCode更改编译路径

vscode打开cpp文件包括#include 头时会报错如下

检测到 #include 错误。请更新 includePath。已为此翻译单元 禁用波形曲线。C/C++ 无法打开 源 文件 "bits/stdc++.h"C/C++

这是因为这个头文件属于 gcc libstdc++ 的内部实现,而不是标准库头文件。MSVC没有提供这一实现。

如果有visual studio,或者wsl,vscode会优先用前两者的编译器,如果前两个都没检测到,vscode才会使用mingw。

为了解决这一问题,只需要在setting.json下指定MinGW的编译路径即可。

"C_Cpp.default.compilerPath": "C:\MinGW\bin\g++.exe",
"C_Cpp.default.intelliSenseMode": "windows-gcc-x64",

即可一劳永逸地解决这一问题

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/395926.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号