vscode配置教程+如何解决vscode中文的问题

vscode配置教程+如何解决vscode中文的问题

一、安装vscode

进入vscode官网:https://vscode.cdn.azure.cn/stable/6c3e3dba23e8fadc360aed75ce363ba185c49794/VSCodeSetup-x64-1.81.1.exe,选择你要下载的类型,即可下载。
下载时只要把第2页“我不同意此协议”改成“我同意此协议”就行了。

二、配置vscode

1.我们需要下载Chinese (Simplified) (简体中文) Language Pack for Visual Studio Code这个插件,点击左侧第5个按扭,输入“chinese”,选择这个插件,点击“install”,下载好了下发会出现一个小窗口,点击这个小窗口的蓝色的按钮就可以改成中文了。

2.再在这个地方搜索“C++”,选择第一个,点击安装,因为我下载过了,所以我这没有。

3.你要下一个c++MinGW64的包,我下的位置是C:/TDM-GCC-64,自行修改。随便写一个c++代码,运行,他会给你丢出一个报错,不管他,你会发现多了一个.VSCODE文件夹,里面还有一个.vscode文件夹,点击去,创建4个文件,如下所示:
c_cpp_properties.json

{
  "configurations": [
    {
      "name": "windows-gcc-x64",
      "includePath": [
        "${workspaceFolder}/**"
      ],
      "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
      ],
      "windowsSdkVersion": "10.0.22000.0",
      "compilerPath": "D:/Msys2-64bit/ucrt64/bin/gcc.exe",
      "cStandard": "${default}",
      "cppStandard": "${default}",
      "intelliSenseMode": "windows-gcc-x64"
    }
  ],
  "version": 4
}

launch.json

{
  "configurations": [
    {
      "name": "C/C++: g++.exe build and debug active file",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "D:\\msys2-x86_64\\ucrt64\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "description": "Set Disassembly Flavor to Intel",
          "text": "-gdb-set disassembly-flavor intel",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "C/C++: g++.exe build active file"
    },
    {
      "name": "C/C++: g++.exe 生成和调试活动文件",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "D:/Msys2-64bit/mingw64/bin",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "D:\\Msys2-64bit\\mingw64\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "为 gdb 启用整齐打印",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "description": "将反汇编风格设置为 Intel",
          "text": "-gdb-set disassembly-flavor intel",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "C/C++: g++.exe 生成活动文件"
    },
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": true,
      "cwd": "d:/code/c++",
      "program": "d:/code/c++/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ],
  "version": "2.0.0"
}

settings.json

{
  "code-runner.runInTerminal": true,
  "code-runner.executorMap": {
    "javascript": "node",
    "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
    "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt -finput-charset=UTF-8 -fexec-charset=GBK && d i r dirdirfileNameWithoutExt",
    "zig": "zig run",
    "cpp": "cd $dir && g++ $fileName -Wall -std=c++20 -g -o $fileNameWithoutExt -finput-charset=UTF-8 -fexec-charset=GBK && $dir$fileNameWithoutExt",
    "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt -finput-charset=UTF-8 -fexec-charset=GBK && $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": "runghc",
    "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",
    "sml": "cd $dir && sml $fileName",
    "mojo": "mojo run"
  },
  "files.associations": {
    "any": "cpp",
    "array": "cpp",
    "atomic": "cpp",
    "barrier": "cpp",
    "bit": "cpp",
    "*.tcc": "cpp",
    "bitset": "cpp",
    "cctype": "cpp",
    "cfenv": "cpp",
    "charconv": "cpp",
    "chrono": "cpp",
    "cinttypes": "cpp",
    "clocale": "cpp",
    "cmath": "cpp",
    "codecvt": "cpp",
    "compare": "cpp",
    "complex": "cpp",
    "concepts": "cpp",
    "condition_variable": "cpp",
    "coroutine": "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",
    "map": "cpp",
    "set": "cpp",
    "string": "cpp",
    "unordered_map": "cpp",
    "unordered_set": "cpp",
    "vector": "cpp",
    "exception": "cpp",
    "expected": "cpp",
    "algorithm": "cpp",
    "functional": "cpp",
    "iterator": "cpp",
    "memory": "cpp",
    "memory_resource": "cpp",
    "numeric": "cpp",
    "optional": "cpp",
    "random": "cpp",
    "ratio": "cpp",
    "regex": "cpp",
    "source_location": "cpp",
    "string_view": "cpp",
    "system_error": "cpp",
    "tuple": "cpp",
    "type_traits": "cpp",
    "utility": "cpp",
    "format": "cpp",
    "fstream": "cpp",
    "future": "cpp",
    "initializer_list": "cpp",
    "iomanip": "cpp",
    "iosfwd": "cpp",
    "iostream": "cpp",
    "istream": "cpp",
    "latch": "cpp",
    "limits": "cpp",
    "mutex": "cpp",
    "new": "cpp",
    "numbers": "cpp",
    "ostream": "cpp",
    "ranges": "cpp",
    "scoped_allocator": "cpp",
    "semaphore": "cpp",
    "shared_mutex": "cpp",
    "span": "cpp",
    "spanstream": "cpp",
    "sstream": "cpp",
    "stacktrace": "cpp",
    "stdexcept": "cpp",
    "stdfloat": "cpp",
    "stop_token": "cpp",
    "streambuf": "cpp",
    "syncstream": "cpp",
    "thread": "cpp",
    "typeindex": "cpp",
    "typeinfo": "cpp",
    "valarray": "cpp",
    "variant": "cpp",
    "*.inc": "cpp",
    "*.def": "cpp"
  },
  "python.testing.unittestArgs": [
    "-v",
    "-s",
    "./python",
    "-p",
    "*test*.py"
  ],
  "python.testing.pytestEnabled": false,
  "python.testing.unittestEnabled": true,
  "files.autoSave": "afterDelay",
  "explorer.confirmDelete": false,
  "chatgpt.lang": "cn",
  "C_Cpp.default.compilerArgs": [
    "-std=c++20",
    "-g"
  ],
  "C_Cpp_Runner.msvcBatchPath": "",
  "C_Cpp_Runner.cCompilerPath": "gcc",
  "C_Cpp_Runner.cppCompilerPath": "g++",
  "C_Cpp_Runner.debuggerPath": "gdb",
  "C_Cpp_Runner.cStandard": "",
  "C_Cpp_Runner.cppStandard": "",
  "C_Cpp_Runner.useMsvc": false,
  "C_Cpp_Runner.warnings": [
    "-Wall",
    "-Wextra",
    "-Wpedantic",
    "-Wshadow",
    "-Wformat=2",
    "-Wcast-align",
    "-Wconversion",
    "-Wsign-conversion",
    "-Wnull-dereference"
  ],
  "C_Cpp_Runner.msvcWarnings": [
    "/W4",
    "/permissive-",
    "/w14242",
    "/w14287",
    "/w14296",
    "/w14311",
    "/w14826",
    "/w44062",
    "/w44242",
    "/w14905",
    "/w14906",
    "/w14263",
    "/w44265",
    "/w14928"
  ],
  "C_Cpp_Runner.enableWarnings": true,
  "C_Cpp_Runner.warningsAsError": false,
  "C_Cpp_Runner.compilerArgs": [],
  "C_Cpp_Runner.linkerArgs": [],
  "C_Cpp_Runner.includePaths": [],
  "C_Cpp_Runner.includeSearch": [
    "*",
    "**/*"
  ],
  "C_Cpp_Runner.excludeSearch": [
    "**/build",
    "**/build/**",
    "**/.*",
    "**/.*/**",
    "**/.vscode",
    "**/.vscode/**"
  ],
  "C_Cpp_Runner.useAddressSanitizer": false,
  "C_Cpp_Runner.useUndefinedSanitizer": false,
  "C_Cpp_Runner.useLeakSanitizer": false,
  "C_Cpp_Runner.showCompilationTime": false,
  "C_Cpp_Runner.useLinkTimeOptimization": false,
  "C_Cpp_Runner.msvcSecureNoWarnings": false
}

tasks.josn

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "D:\\msys2-x86_64\\ucrt64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-std=c++20",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-finput-charset=UTF-8",
                "-fexec-charset=GBK"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件",
            "command": "D:/Msys2-64bit/mingw64/bin/g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "D:/Msys2-64bit/mingw64/bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

在settings.json中中文路径就已经解决了,但中文名还在解决
4.然后下载Code Runner,也是上面的方法,我就不讲了。
这样c++就配好了。

如何解决vscode中文名的问题

首先我们进入设备

搜索“区域”,选择“区域设备”

点击右侧“其他日期、时间和区域设置”

点击“区域”

点击“更改系统区域设备©…”

勾选“Beta 版: 使用 Unicode UTF-8 提供全球语言支持(U)”,电脑会叫你重启,你重启就行了

这样vscode就不会要求文件路径不能有中文字符了,但Dev_C++会的字符会坏掉,一些游戏和压缩包的文字会出错。

  • 9
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
### 回答1: VSCode是一款免费且开源的代码编辑器,广受开发者欢迎。下面是VSCode的安装教程: 首先,打开你的浏览器,输入VSCode的官方网站地址(https://code.visualstudio.com/)。 在网站的首页,你可以看到“下载”按钮,点击进入下载页面。 在下载页面,你将看到不同的操作系统选择。根据你当前使用的操作系统,选择相应的下载链接,例如如果你使用的是Windows系统,点击“Windows”链接。 在选择操作系统后,会自动开始下载VSCode的安装包。等待下载完成。 下载完成后,点击安装包,开始安装文件。 安装过程中,会弹出一些选项供你选择,例如选择安装位置、添加文件关联等。可以根据个人需求进行设置。 安装完成后,会在桌面或启动菜单中生成VSCode的图标,双击打开。 第一次打开VSCode时,会看到一些默认设置,可以根据个人需求进行更改,例如选择显示语言、插件安装等。 此时,VSCode就安装并配置好了。你可以直接开始编辑代码,也可以通过插件扩展VSCode的功能。 总结一下,VSCode的安装过程简单而快速。只需要打开官方网站,选择适合你的操作系统的安装包,并按照提示进行安装和配置即可。感谢你的提问,希望对你有所帮助。 ### 回答2: VSCode 是一款跨平台的轻量级代码编辑器,适用于 Windows、Mac 和 Linux 等操作系统。下面是 VSCode 的安装教程: 1. 首先,你需要访问 VSCode 的官方网站,即 https://code.visualstudio.com/ ,然后点击页面上的下载按钮。 2. 在下载页面上,你可以选择对应操作系统的安装包进行下载。如果你使用的是 Windows 系统,可以点击下载按钮后会自动下载适用于 Windows 的安装包。如果你使用的是 Mac 或 Linux 系统,你需要在下载页面上找到相应的安装包进行下载。 3. 下载完成后,双击安装包进行安装。在 Windows 系统上,你需要按照安装向导的指示进行操作。在 Mac 系统上,你只需要将安装包拖动到应用程序文件夹中即可。 4. 安装完成后,打开 VSCode。你会看到一个简洁的编辑器界面。 5. 首次使用时,VSCode 会提示你安装一些常用的扩展。你可以根据自己的需求选择是否安装这些扩展。 6. 完成安装后,你可以开始使用 VSCode 来编辑代码了。它提供了丰富的功能,如代码高亮、自动补全、调试等,可以提高你的开发效率。 总结起来,你需要下载适用于你的操作系统的安装包,并按照安装向导的指示进行安装。安装完成后,你就可以开始使用 VSCode 来编辑代码了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值