解決VS Code配置Arduino開發環境出現未定義標識

  自己在配置VS Code Arduino開發環境中遇到的問題,類似這種,錯誤顯示未定義標識符。關於VS Code配置Arduino開發環境 網上有需多,我就不在敘述了,我只是記錄我自己遇到的問題。
  主要問題是頭文件索引丟失,intellisense不能自動找到需要的頭文件路徑。需要在用戶設置中強制intellisense使用Tag Parser,遞歸方式檢索頭文件。
在這裏插入圖片描述

添加方式方式如下:

首先

在這裏插入圖片描述

其次在輸入框輸入Arduino,檢索。

在這裏插入圖片描述

打開settings.json 配置相關文件:

添加如下所示的2行代碼。

在這裏插入圖片描述

自己的配置代碼如下:

其中 “arduino.path”: “D:\Arduino”,是自己安裝Arduino的路徑。
{
    // 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": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "D:/MinGW/mingw64/bin",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "Build"
        }
    ],
    "window.zoomLevel": 0,
    "terminal.integrated.inheritEnv": false,
    "task.autoDetect": "off",
    "kite.showWelcomeNotificationOnStartup": false,
    "arduino.path": "D:\\Arduino",  //這個是安裝路徑,可能不一樣
    "C_Cpp.updateChannel": "Insiders",
    "C_Cpp.intelliSenseEngineFallback": "Disabled", //需要添加的
    "C_Cpp.intelliSenseEngine": "Tag Parder",  //  需要添加的
    "arduino.additionalUrls": "",
    "workbench.colorTheme": "Monokai"
}


保存之後,發現未定義標識錯誤消失了。
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章