zoukankan      html  css  js  c++  java
  • VSCode C++开发环境配置

    一、准备工作

      1.官网下载VSCode 下载

      2.安装并配置MinGW环境  下载

    二、配置(重要)

      1.打开VSCode并安装C++插件

      

      2.配置launch.json、task.json、setting.json

      1)launch.json,此文件是工程自动创建的。 

    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "g++.exe build and debug active file",
                "type": "cppdbg",
                "request": "launch",
                "program": "${fileDirname}\${fileBasenameNoExtension}.exe",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false, //true表示使用弹出的终端,cmd。false代表使用ide自带的终端
                "MIMode": "gdb",
                "miDebuggerPath": "D:\wei.yang\tony\tool\mingw64\bin\gdb.exe",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ],
                "preLaunchTask": "task g++" //此处的文案描述要和task.json中的label标签中的内容一致
            }
        ]
    }

      2)按F5进行调试,会弹出找不到会弹出找不到任务"task g++,点击配置(configure)会自动生成task.json文件

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "task g++",//此处的文案和launch中的preLaunchTask中的文案一样,(必须保持一样)
                "type": "shell",
                "command": "D:\wei.yang\tony\tool\mingw64\bin\g++.exe",
                "args": [
                    "-g",
                    "${file}",
                    "-o",
                    "${fileDirname}\${fileBasenameNoExtension}.exe"
                ],
                "options": {
                    "cwd": "${workspaceFolder}"
                },
                "problemMatcher": [
                    "$gcc"
                ],
                "group": "build"
            }
        ]
    }

      3)到此再切回代码,按F5运行,仍然会提示如下图所示。

      

      此时莫慌

      4)选择File->Preferences->Settings打开设置页面,在搜索框中输入shell

      

      点击Edit in setting.json,会自动生成setting.json文件

      在json中添加生成exe文件的支持。如下图所示:

    {
        "terminal.integrated.automationShell.windows": "C:\Windows\System32\cmd.exe"
    }

      好了,以上就是全部的配置,此时你再按F5运行项目,就会再控制台输出你想要的的内容。

      

      

  • 相关阅读:
    tkinter 对键盘和鼠标事件的处理
    python基础知识字符串与元祖
    python中的raw string的使用
    python使用tkinter做界面之颜色
    windows强制删除文件和文件夹
    Python 类的继承__init__() takes exactly 3 arguments (1 given)
    python tkinter txt窗口,开线程两个卡死
    python Tkinter的Text组件中创建x轴和y轴滚动条,并且text文本框自动更新(三)
    tkinter界面卡死的解决办法
    python Tkinter的Text组件中创建x轴和y轴滚动条,并且text文本框自动更新(二)
  • 原文地址:https://www.cnblogs.com/tony-yang-flutter/p/14858634.html
Copyright © 2011-2022 走看看