C++:工具VSCode的编译和调试文件内容:

ubuntu24.04, vscode 配置文件 C++ 的环境

下载的gcc,使用命令为

cpp 复制代码
sudo aptitude update
sudo aptitude install build-essential -f


- `sudo`: 以超级用户权限运行命令。
- `aptitude`: 包管理工具,用于安装、更新和删除软件包。
- `install`: 安装指定的软件包。
- `build-essential`: 一个包含编译软件所需基本工具的元包,包括 `gcc`、`g++`、`make` 等。
- `-f`: 尝试修复系统中存在的依赖关系问题。
note:这里在学习C++的GUI一块时,需要下载FTLK,但一直不能顺利下载成功,原因是我下载了gcc相关的package产生冲突,所以重装系统后使用了这种统一的命令安装。

默认下载在文件/usr/bin/g++

编译文件

task.json

cpp 复制代码
{   //https://code.visualstudio.com/docs/cpp/config-linux
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "Task generated by Debugger."
        }
    ]
}

调试文件

launch.json

cpp 复制代码
{
    // 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": "(gdb) Attach",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        },
   
    
    ],

    
    
}
相关推荐
大米粥哥哥1 天前
Qt libcurl的下载、配置及简单测试 (windows环境)
开发语言·c++·windows·qt·http·curl·libcurl
闻缺陷则喜何志丹1 天前
【逆序对 博弈】P10737 [SEERC 2020] Reverse Game|普及+
c++·算法·洛谷·博弈·逆序堆
大锦终1 天前
【算法】哈希表专题
c++·算法·leetcode·哈希算法·散列表
蒹葭玉树1 天前
【C++上岸】C++常见面试题目--数据结构篇(第十六期)
数据结构·c++·面试
睡不醒的kun1 天前
leetcode算法刷题的第二十三天
数据结构·c++·算法·leetcode·职场和发展·贪心算法
mit6.8241 天前
[re_2] rpc|http|nginx|protobuf|
网络·c++
weixin_491865161 天前
vscode下leetcode插件cookie登录
ide·vscode·编辑器
要做朋鱼燕1 天前
【C++】 Vector容器操作全解析
开发语言·c++·笔记·学习笔记
利刃大大1 天前
【高并发内存池】三、线程缓存的设计
开发语言·c++·缓存·项目·内存池
Miracle&1 天前
C++后端开发重点知识点
开发语言·c++