使用Visual Studio Code开发Arduino相关配置

看了博文1 博文2,知道了VSCode安装Arduino插件可以用来开发Arduino项目,但是实际使用时提示头文件未包含,显然是设置问题。   #include errors detected. Please update your includePath.  

百度没有搜索到相关的中文资料,搜到英文的资料,这里记录一下。

文件关联设置

设置文件 settings.json 添加以下脚本

// Files
    // Configure file associations to languages (e.g. "*.extension": "html").
    // These have precedence over the default associations of the languages 
    // installed.
    "files.associations": {
        "*.ino": "cpp"
    },

设置头文件路径

 在项目 .vscode 文件夹中 创建  c_cpp_properties.json 文件,并添加相关头文件路径信息。

{
            "name": "Arduino",
            "includePath": [
                "{path-to-arduino}/hardware/arduino/avr/cores/arduino/",
                "{path-to-arduino}/hardware/arduino/avr/libraries/EEPROM/",
                "{path-to-arduino}/hardware/arduino/avr/libraries/SPI/",
                "{path-to-arduino}/hardware/arduino/avr/libraries/SoftwareSerial/",
                "{path-to-arduino}/hardware/arduino/avr/libraries/Wire/",
                "{path-to-arduino}/hardware/tools/avr/avr/include/",
                "{path-to-arduino}/hardware/tools/avr/avr/include/avr/",
                "{path-to-arduino}/hardware/tools/avr/avr/include/compat/",
                "{path-to-arduino}/hardware/tools/avr/avr/include/util/",
                "{path-to-arduino}/hardware/tools/avr/lib/gcc/avr/4.*.*/include/",
                "{path-to-arduino}/hardware/tools/avr/lib/gcc/avr/4.*.*/include-fixed/"
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值