关于程序VScode报错: Exit with code=1的问题

以VScode配置arduino文件为例,若arduino文件出现报错,那么code是一定会有问题的

当arduino如上图显示正常加载无报错时,此时VScode程序报错,总显示Exit with code=1,若根据code的报错提示找不出报错原因的话,我们可以不影响工作区程序去修改原配置文件

下面是 程序的arduino.json文件

                     下面为takes.json文件的代码

{

    "tasks": [

        {

            "type": "cppbuild",

            "label": "C/C++: gcc.exe 生成活动文件",

            "command": "C:\\msys32\\mingw32\\bin\\gcc.exe",

            "args": [

                "-fdiagnostics-color=always",

                "-g",

                "${file}",

                "-o",

                "${fileDirname}\\${fileBasenameNoExtension}.exe"

            ],

           

            "options": {

                "cwd": "${fileDirname}"

            },

            "problemMatcher": [

                "$gcc"

            ],

            "group": {

                "kind": "build",

                "isDefault": true

            },

            "detail": "调试器生成的任务。"

        }

    ],

    "version": "2.0.0"

}

settings.json文件代码如下

{

  "C_Cpp.dimInactiveRegions": false,

  "files.associations": {

    "iostream": "cpp",

    "tuple": "cpp",

    "stack": "cpp",

    "string": "cpp",

    "ostream": "cpp",

    "ios": "cpp",

    "istream": "cpp",

    "vector": "cpp",

    "fstream": "cpp",

    "cmath": "cpp"

  },

  "C_Cpp_Runner.msvcBatchPath": "",

  "C_Cpp_Runner.cCompilerPath": "c:/msys32/mingw32/bin/gcc.exe",

  "C_Cpp_Runner.cppCompilerPath": "g++",

  "C_Cpp_Runner.debuggerPath": "gdb",

  "C_Cpp_Runner.cStandard": "",

  "C_Cpp_Runner.cppStandard": "",

  "C_Cpp_Runner.useMsvc": false,

  "C_Cpp_Runner.warnings": [

    "-Wall",

    "-Wextra",

    "-Wpedantic",

    "-Wshadow",

    "-Wformat=2",

    "-Wconversion",

    "-Wnull-dereference",

    "-Wsign-conversion"

  ],

  "C_Cpp_Runner.enableWarnings": true,

  "C_Cpp_Runner.warningsAsError": false,

  "C_Cpp_Runner.compilerArgs": [],

  "C_Cpp_Runner.linkerArgs": [],

  "C_Cpp_Runner.includePaths": [],

  "C_Cpp_Runner.includeSearch": [

    "*",

    "**/*"

  ],

  "C_Cpp_Runner.excludeSearch": [

    "**/build",

    "**/build/**",

    "**/.*",

    "**/.*/**",

    "**/.vscode",

    "**/.vscode/**"

  ],

  "C_Cpp.errorSquiggles": "disabled"

}

//其中mingw32\\bin\\gcc.exe文件根据自己的路径修改(一般都在C盘c:/msys32/mingw32/bin/gcc.exe)

确保不会在发生报错,最好在设置里关闭自动更新版本。

解决Exit with code=1的问题,(确保无中文路径)

  • 15
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值