Young143's Blog 如果我死在追逐自由的路上,那便是我的终点.
博主

5天前在线

Young143's Blog
如果我死在追逐自由的路上,那便是我的终点.
歌曲封面 未知作品
  • 歌曲封面错位时空艾辰
  • 歌曲封面牵丝戏银临
  • 歌曲封面小宇蓝心羽
  • 歌曲封面可不可以张紫豪

豫ICP备2024074488号

萌ICP备20241431号

网站已运行 2 年 219 天 2 小时 16 分

Powered by Typecho & Sunny

6 online · 42 ms

Title

📖 VS Code配置部分语言编译环境

Young143

·

代码与技术

·

Article

写在前面

由于本人喜欢用VS Code这种轻量的编辑器,但是却不能开箱即用,有时重装系统后就要从新配置,所以写下此篇来记录部分语言的配置方法.

C/C++

1.安装gcc等编译器:

下载地址:https://winlibs.com/

下载后安装到任意位置,再Windows的环境的path中添加:你的安装的地址/mingw64/bin.

记得要将/bin下的mingw32-make.exe名称改为make.exe,以便make命令能正常使用.

2.VS Code配置:

安装插件:

一般安装第一个后面两个就会提示安装.

3.调试配置:

这是我的编译和调试配置:

tasks:

♾️ json 代码:
{
    "tasks": [
        {
            "type": "shell",
            "label": "g++ build",
            "command": "C:\\CodePath\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": "$gcc",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": true
            }
        },
        {
            "label": "make build",
            "type": "shell",
            "command": "make",
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": "$gcc",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": true
            }
        }
    ],
    "version": "2.0.0"
}

luanch

♾️ json 代码:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C/C++ g++",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ build"
        },
        {
            "name": "C/C++ make",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "make build"
        }
    ]
}

GO

1.安装GO编译器:

官网地址:https://golang.google.cn/

下载安装msi基本就可以,一般不需要多余的配置.

一般默认开启了go111module,也就不需要配置传统gopath了

要调整一下源:

♾️ text 代码:
#重新设置成七牛镜像源(推荐)或阿里镜像源(用原有的会比较慢)
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy

2.VS Code配置

安装go语言插件:

再VS Code的命令面板输入Go: install/update tools以安装调试所需依赖.

3.调试配置

这是我的调试配置:

luanch:

♾️ json 代码:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Go Debug",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${fileDirname}/${fileBasenameNoExtension}.go",
            "console": "integratedTerminal"
        }
    ]
}

Node.js

1.下载安装Node.js

Node.js官网地址:https://nodejs.org/zh-cn

下载安装,并在安装目录下设立两个文件夹:node_global,node_cache.

配置一下环境变量:

在系统环景变量中添加:NODE_HOME内容为你的安装的地址/nodejs.

在系统环境变量中的path添加:%NODE_home%/node_global%NODE_home%/node_cache.

把用户环境变量中的:C:User/用户名/AppDate/Roaming/npm改为你的安装的地址/nodejs/node_global

执行一下命令:

  • 设置缓存位置

npm config set cache 你的安装的地址/nodejs/node_cache

  • 设置全局模块地址

npm config set prefix 你的安装的地址/nodejs/node_global

换源

执行以下命令换镜像源:

♾️ text 代码:
npm config set registry http://mirrors.cloud.tencent.com/npm/ #腾讯云

npm config set registry https://npm.aliyun.com #阿里云

2.VS Code配置

安装一下插件即可:

设置权限

设置安装目录nodejs的权限,开启用户的完全控制权限,并在管理员权限下的powershell执行一下命令:Set-ExecutionPolicy Unrestricted 否者npm会无法安装插件或者VS Code下npm命令无法使用.

HTML + CSS +Javascript

一般安装一下插件即可:

这两个用来方便编写代码:

现在已有 96 次阅读,0 条评论,0 人点赞
Author:Young143
作者
VS Code配置部分语言编译环境
当前文章累计共 5540 字,阅读大概需要 2 分钟。
九月份小结
2024年10月1日 · 0评论
archlinux配置笔记
2024年9月23日 · 0评论
我的第一个程序--YPush
2024年11月23日 · 9评论
Comment:共0条
发表
搜 索 消 息 足 迹
你还不曾留言过..
你还不曾留下足迹..
博主 不再显示
博主