linux下vscode配置C/C++环境的.json文件

linux下vscode配置C/C++环境的.json文件

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": "available launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",   
    "tasks":[  // 可以有多个任务
        {
            "label": "build",       // 编译任务名
            "type": "shell",        // 编译任务的类型,通常为shell/process类型
            "command": "g++",       // 编译命令
            "args":[
                "-g",               // 该参数使编译器在编译的时候产生调试信息
                "${workspaceFolder}/${fileBasename}",    // 被编译文件,通常为.cpp/.c/.cc文件等
                "-I",                                    // include path指令
                "/usr/include",                          
                "-L",                                    // lib路径
                "/usr/lib/x86_64-linux-gnu",             
                "-l",                                    // 链接库文件1
                "opencv_core",                           
                "-l",                                    // 链接库文件2
                "opencv_highgui",                        
                "-o",                                    // 生成指定名称的可执行文件
                "${workspaceFolder}/${fileBasenameNoExtension}.out"  
          /* -g hello.cpp -I/usr/include -L/usr/lib/x86_64-linux-gnu -lopencv_core -o hello.out */
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "cmakebuild",      
            "type": "shell", 
            "command": "cd build && cmake ../ && make",    // shell 编译命令,做并运算,即前一命令执行失败,则后一命令也不执行
            "args": []
        }
    ] 

}

setting.json

{

    "C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools",
  
    "cmake.configureSettings": {"CMAKE_TOOLCHAIN_FILE": "toolchain.cmake",
  
    },
  
  }

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64",
            "configurationProvider": "vector-of-bool.cmake-tools"
        }
    ],
    "version": 4
}
  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值