美文网首页
Windows 上 VS Code 搭建简易 C++ 环境

Windows 上 VS Code 搭建简易 C++ 环境

作者: u14e | 来源:发表于2019-04-23 17:32 被阅读0次

访问 MinGW-w64 - for 32 and 64 bit Windows 页面,找到最新版的 x86_64-posix-sjlj 包,下载,并解压。(不要点击 Download Latest Version, 会下载在线安装包, 安装很慢)

将解压好的文件移到比较好的位置: eg. D:\mingw64, 并将 D:\mingw64\bin 加入到 环境变量 中,打开终端输入 g++ --version 验证:

image.png

VS Code 安装 C/C++ 插件,并配置 c_cpp_properties.json:

主要是添加 "compilerPath": "D:/mingw64/bin/g++.exe"

{
    "configurations": [
        {
            "name": "Win32",
            "compilerPath": "D:/mingw64/bin/g++.exe",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

参考链接:
- Visual Studio Code 如何编写运行 C、C++ 程序? - 谭九鼎的回答 - 知乎
- https://code.visualstudio.com/docs/cpp/config-mingw

相关文章

网友评论

      本文标题:Windows 上 VS Code 搭建简易 C++ 环境

      本文链接:https://www.haomeiwen.com/subject/bykbgqtx.html