栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

VSCODE配置C++和Python环境

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

VSCODE配置C++和Python环境

VSCODE配置C++和Python环境
  • 1.VSCode的下载
  • 2.配置C++环境
    • 明确一些概念

1.VSCode的下载

官网链接
记得下载.deb格式的

2.配置C++环境

点击运行-启动调试或者直接按F5会弹出launch.json的设置,之后会跳出task.json,要配置这两个文件,记得保存后就可以运行了。

明确一些概念

单次运行一个脚本视为一个 task,相应的配置文件为 tasks.json,整个文件夹或者多个文件夹视为一个工作空间,配置文件为 settings.json,调试环境的配置文件叫 launch.json,这些配置文件是需要手动编辑的,编辑完保存好就会替代默认的配置文件生效。

launch.json配置
 "version": "0.2.0",
    "configurations": [
        {
            "name": "Python",
            "type": "python",
            "request": "launch",
            "stopOnEntry": true,
            "pythonPath": "${config:python.pythonPath}",
            "program": "${file}",
            "cwd": "${workspaceFolder}",
            "env": {},
            "envFile": "${workspaceFolder}/.env",
            "console": "integratedTerminal"
        },
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/${filebasenameNoExtension}.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
tasks.json配置
 "tasks": [
        {
            "label": "python",
            "type": "shell",
            "command": "python",
            "args": [
                "${file}"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "always",
                "panel": "shared"
            }
        },
        {
            "type": "shell",
            "label": "build",
            "command": "/usr/bin/g++",
            "args": [
                "-g", "${file}", "-std=c++11", "-o", "${filebasenameNoExtension}.out"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
setting.json配置
{
    "editor.fontSize": 16,
        "python.pythonPath": "/usr/bin/python2.7",
        "python.formatting.provider": "yapf",
        "files.insertFinalnewline": true
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/347295.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号