加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

vscode在win10 / linux下的.vscode文件夹的配置 (c++/c)

发布时间:2020-12-14 02:41:57 所属栏目:Windows 来源:网络整理
导读:系统方面配置自行查找 linux: launch.json { // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 " version " : " 0.2.0 " , " configurations " : [ { " name

系统方面配置自行查找

linux:

launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0","configurations": [
        {
            "name": "(gdb) Launch","type": "cppdbg","request": "launch","program": "${workspaceRoot}/${fileBasenameNoExtension}.out","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
                }
            ],"preLaunchTask": "build"
        }
    ]
}

tasks.json

{
    "version": "2.0.0","tasks": 
    [
        {
            "label": "build",//任务名,和lanuch.json中的"preLaunchTask":"build"一致
            "type": "shell","command": "g++","args":["-g","${workspaceRoot}/${fileBasenameNoExtension}.cpp","-o","${fileBasenameNoExtension}.out"],//要编译的文件mian_test.cpp,${workspaceRoot}表示vscode所打开的工作目录
            "problemMatcher":
            {
                "owner":"cpp","fileLocation":["relative","${workspaceRoot}"],"pattern":
                {
                    "regexp": "^([^\s].*)\((\d+,\d+)\):\s*(.*)$","file": 1,"line":2,"column":3,"severity": 4,"location": 2,"message": 5
                }
            }
        }
 
    ]
}

win10:

launch.json

{
    "version": "0.2.0","preLaunchTask": "build","program": "${fileDirname}/${fileBasenameNoExtension}.exe","miDebuggerPath": "C:/mingw/bin/gdb.exe",// 这里修改GDB路径为安装的mingw64的bin下的gdb.exe路径
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb","ignoreFailures": true
                }
            ]
        }]

tasks.json

{
    "version": "2.0.0","tasks": [
        {
            "label": "build","type": "shell","group": {
                "kind": "build","isDefault": true
            },"presentation": {
                "echo": true,"reveal": "always","focus": false,"panel": "shared"
            },"windows": {
                "command": "g++","args": [
                    "-ggdb",""${file}"","--std=c++11","-o",""${fileDirname}${fileBasenameNoExtension}.exe""
                ]
            }
        }
    ]
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读