zoukankan      html  css  js  c++  java
  • vscode linux c++ 配置

    简介

    最官方的配置方案 https://code.visualstudio.com/docs/cpp/config-linux

    有三个文件会生成

    tasks.json (编译器构建设置)
    launch.json (调试器设置)
    c_cpp_properties.json (编译器路径和IntelliSense设置)

    三个文件的配置命令

    tasks.json

    Terminal > Configure Default Build Task
    选择 C/C++: g++ build active file

    lauch.json

    Run > Add Configuration... and then choose C++ (GDB/LLDB).
    选择 Choose g++ build and debug active file.

    c_cpp_properties.json

    ctrl + shift + p 打开命令行 输入 c/c++
    选择带有 ui 的那个
    C/C++: Edit Configurations (UI)

    复用配置文件

    VS Code现在已配置为在Linux上使用gcc。该配置适用于当前工作空间。要重用配置,只需将JSON文件复制到.vscode新项目文件夹(工作区)中的文件夹中,然后根据需要更改源文件和可执行文件的名称。

    tasks.json

    {
        "version": "2.0.0",
        "tasks": [
            {
                "type": "shell",
                "label": "C/C++: g++ build active file",
                "command": "/usr/bin/g++",
                "args": [
                    "-g",
                    "${file}",
                    "-o",
                    "${fileDirname}/${fileBasenameNoExtension}"
                ],
                "options": {
                    "cwd": "/usr/bin"
                },
                "problemMatcher": [
                    "$gcc"
                ],
                "group": {
                    "kind": "build",
                    "isDefault": true
                }
            },
            {
                "type": "shell",
                "label": "g++ build active file",
                "command": "/usr/bin/g++",
                "args": [
                    "-g",
                    "${file}",
                    "-o",
                    "${fileDirname}/${fileBasenameNoExtension}"
                ],
                "options": {
                    "cwd": "/usr/bin"
                }
            }
        ]
    }
    

    lauch.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": "调试",
                "type": "cppdbg",
                "request": "launch",
                "program": "${fileDirname}/bin/${fileBasenameNoExtension}",
                "args": ["-p", "3", "4", "5", "6"],
                "stopAtEntry": false,
                "cwd": "\",
                "environment": [],
                "externalConsole": false,
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "description": "为 gdb 启用整齐打印",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            },
            {
                "name": "clang - 生成和调试",
                "type": "cppdbg",
                "request": "launch",
                "program": "${fileDirname}/bin/${fileBasenameNoExtension}", // 可以改成绝对路径
                "args": ["-p", "3"],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false,
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "description": "为 gdb 启用整齐打印",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ],
                "preLaunchTask": "clang build active file",
                "miDebuggerPath": "/usr/bin/gdb"
            }
        ]
    }
    
    

    c_cpp_properties.json

    {
        "configurations": [
            {
                "name": "Linux",
                "includePath": [
                    "${workspaceFolder}/**"
                ],
                "defines": [],
                "compilerPath": "/usr/bin/gcc",
                "cStandard": "c11",
                "cppStandard": "c++17",
                "intelliSenseMode": "clang-x64"
            }
        ],
        "version": 4
    }
    
    Hope is a good thing,maybe the best of things,and no good thing ever dies.----------- Andy Dufresne
  • 相关阅读:
    Kindeditor 代码审计
    tamper参数
    大学站注入点(安全狗)
    sqlmap注入小结
    tamper绕WAF详解
    网站安全狗最新版绕过测试
    大学站防SQL注入代码(ASP版)
    防SQL注入代码(ASP版)
    xss利用和检测平台
    tamper绕WAF小结
  • 原文地址:https://www.cnblogs.com/eat-too-much/p/12840847.html
Copyright © 2011-2022 走看看