VS Code+Arduino插件编译/验证(Verify)报“构建时出错:exit status 1”

发布时间 2023-04-20 22:55:37作者: Macrored

一、问题现象

vscode编译/验证(Verify)Arduino的.ino文件,报构建时出错:exit status 1,如下:

[Starting] Verifying sketch 'src.ino'
Please see the build logs in output path: e:\WorkSpace\Code\c-c++\esp32\esp32s3\build
构建时出错:exit status 1
[Warning] Failed to generate IntelliSense configuration.
[Error] Verifying sketch 'src.ino': Exit with code=1

二、问题原因

Arduino的.ino文件用vscode打开每次编译/验证(Verify)都会报警告:

[Warning] Output path is not specified. Unable to reuse previously compiled files. Build will be slower. See README.

意思是编译输出目录没有指定,会很慢;所以在.vscode/arduino.json中设置了output属性值,为了让编译缓存有地方存放,而不是每次都在TEMP目录生成一个新的。

结果再编译就报了开头那个构建时出错:exit status 1错误。

三、解决方法

发现编译输出路径不能有特殊字符,连+也不行,随后将路径改成全英文字母,编译/验证(Verify)通过。