• vscode搭建c/c++环境


    1. 安装mingw64

    2.vscode安装c/c++插件,run插件

    3.在workspace/.vscode文件夹下新建三个文件:

    1)c_cpp_properties.json

    {

        "configurations": [

            {

                "name": "Win32",

                "includePath": [

                    "${workspaceFolder}/**"

                ],

                "defines": [

                    "_DEBUG",

                    "UNICODE",

                    "_UNICODE"

                ],

                "windowsSdkVersion": "10.0.17763.0",

                "compilerPath": "E:\\mingw64\\bin\\g++.exe", /*bin目录下的g++.exe,两个反斜杠\\*/

                "cStandard": "c11",

                "cppStandard": "c++17",

                "intelliSenseMode": "${default}"

            }

        ],

        "version": 4

    }

    2)launch.json

    {

        "version": "0.2.0",

        "configurations": [

            {

                "name": "g++.exe build and debug active file",

                "type": "cppdbg",

                "request": "launch",

                "program": "${fileDirname}\\build\\${fileBasenameNoExtension}.exe", /*收纳exe可执行文件*/

                "args": [],

                "stopAtEntry": false,

                "cwd": "${workspaceFolder}",

                "environment": [],

                "externalConsole": true,

                "MIMode": "gdb",

                "miDebuggerPath": "E:\\mingw64\\bin\\gdb.exe", /*bin目录下的gdb.exe,两个反斜杠\\*/

                "setupCommands": [

                    {

                        "description": "为 gdb 启用整齐打印",

                        "text": "-enable-pretty-printing",

                        "ignoreFailures": true

                    }

                ],

                "preLaunchTask": "task g++"

            }

        ]

    }

    3)tasks.json

    {

        "tasks": [

            {

                "type": "cppbuild",

                "label": "C/C++: g++.exe 生成活动文件",

                "command": "E:\\mingw64\\bin\\g++.exe",

                "args": [

                    "-fdiagnostics-color=always",

                    "-g",

                    "${file}",

                    "-o",

                    "${fileDirname}\\${fileBasenameNoExtension}.exe"

                ],

                "options": {

                    "cwd": "${fileDirname}"

                },

                "problemMatcher": [

                    "$gcc"

                ],

                "group": {

                    "kind": "build",

                    "isDefault": true

                },

                "detail": "调试器生成的任务。"

            }

        ],

        "version": "2.0.0"

    }

    注意:这里三个文件 关于是mingw的安装位置,要根据自己的安装位置修改一下

  • 相关阅读:
    PAT 乙级 1002 写出这个数(思路+AC代码)
    利用python的Matplotlib库进行基本绘图
    视频监控/视频汇聚/安防视频监控平台EasyCVR如何将默认快照的raw格式改为jpg/base64格式?
    【实操日记】使用 PyQt5 设计下载远程服务器日志文件程序
    分布式多级缓存SDK设计的思考
    Kubernetes外部服务管理Ingress介绍
    对于非阻塞命名管道的测试 O_NONBLOCK
    【Azure 事件中心】Azure Event Hub 新功能尝试 -- 异地灾难恢复 (Geo-Disaster Recovery)
    windows:批处理bat入门
    odoo javascript参考(四)
  • 原文地址:https://blog.csdn.net/weixin_41415820/article/details/133683284