vscode配置C调试环境(launch.json tasks.json setting.json)

废话不多说,直接甩配置代码。如有在参考过程中有问题请联系我。

首先,tasks.json是用来设置指令编译代码,launch.json是设置执行环境来执行代码。setting是设置语言环境;

tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",  // task的名字是build,在launch.json内根据此任务名调用此任务;

            "type": "shell",   // 任务执行的是shell命令

            "command": [ "vcvarsall.bat && gmake TARGET_PLATFORM=PC TARGET_BUILD=debug CORE=eve RUN_REF_FOR_STATS=1  all"],  // 执行的具体指令

            "args": [         // 如果上述的shell命令需要对象,则在这里添加,不需要可直接删掉;
                "'-Wall'",
                "'-std=c++17'",  //使用c++17标准编译
                "'${file}'", //当前文件名
                "-o", //对象名,不进行编译优化
                "'${fileBasenameNoExtension}.exe'",  //当前文件名(去掉扩展名)
            ],

            "problemMatcher": [
                "$msCompile"      //设置捕获错误的工具;
            ]
        }
    ]
}

launch.json:

备注1:编译器的参数,可以用ctrl+space来查看有哪些可用参数,也可以在configurations中存在鼠标光标的情况下,点击右下自动出现的Add Configurations按钮。

备注2:应该选 launch不选attach,attach用来给正在执行的文件用的,比如网页中的组件,而launch是执行新文件。

{
    // 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": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",     // 执行当前文件
            "program": "D:\\PROCESSOR_SDK_VISION_03_04_00_00\\ti_components\\algorithms\\REL.TIDLSRC.01.01.01.00\\modules\\ti_dl\\test\\out\\eve_test_dl_algo_debug_ref.out.exe",
            //"program": "D:\\Aprj3_CNN_Test\\FromLamei190505\\tidl_model_import.out.exe",
            "args": ["D:\\Aprj3_CNN_Test\\FromLamei190505\\tempDir\\configFilesList.txt"],
            //"args": ["D:\\Aprj3_CNN_Test\\FromLamei190505\\tempDir\\mobilenetv1fc1.txt"],
            "stopAtEntry": false,        // 选为true则会在打开控制台后停滞,暂时不执行程序,一般选false.
            "preLaunchTask": "build",    //task的名字,一定要跟上述的task名字对应好;
            "cwd": "D:\\Aprj3_CNN_Test\\FromLamei190505",  //当前执行程序的路径
            "environment": [],
            "externalConsole": true
        }
    ]
}

setting.json:

{
    "files.associations": {
        "tidl_alg_int.h": "c",
        "limits": "c"
    }
}

 

 

  • 5
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值