[ISSUE] Workbench IDE OSX - "pinMode is undefined"

With the most basic sketch and a complete reinstall of vscode (although my extensions synced down) and particle workbench (I even went into the app data / library or whatever it is on OSX and deleted the files leftover after uninstalling)

I am getting really dumb errors in my editor. All the basic arduino functions don’t seem to be identified. pinMode / digitalWrite are both broken in the example below.

I think this could have to do with my includes?

#define LED 8          // the number of the LED pin
void setup()
{
  pinMode(LED, OUTPUT);
}

void loop()
{
    digitalWrite(LED, HIGH);
}

identifier “pinMode” is undefinedC/C++(20)
identifier “OUTPUT” is undefinedC/C++(20)
identifier “digitalRead” is undefinedC/C++(20)

settings.json

{
    "extensions.ignoreRecommendations": true,
    "C_Cpp.default.configurationProvider": "particle.particle-vscode-core",
    "cortex-debug.openocdPath": "${command:particle.getDebuggerOpenocdPath}",
    "files.associations": {
        "*.ino": "cpp"
    },
    "particle.firmwareVersion": "3.0.0",
    "particle.targetPlatform": "bsom",
    "C_Cpp.default.forcedInclude": []
}

System audit

{
    "username": "",
    "workspace": {
        "name": "buzz",
        "isWorkspace": false,
        "folders": [
            {
                "location": "/Users/username/code/buzz",
                "hasValidPath": true,
                "settings": {
                    "firmwareName": "deviceOS",
                    "firmwareVersion": "3.0.0",
                    "targetDevice": "",
                    "targetPlatform": "bsom",
                    "compileButtonAction": "localAppDeviceOS",
                    "flashButtonAction": "localAppDeviceOS",
                    "disableWelcomeScreen": false,
                    "disableDeviceOSOutdatedCheck": false,
                    "disableLocalCompilerDirtyCheck": false,
                    "enableVerboseLocalCompilerLogging": false,
                    "compileDefines": [],
                    "customDeviceOSLocation": "",
                    "maxAllowedToolchains": 4
                },
                "files": [
                    ".git",
                    ".git/HEAD",
                    ".git/branches",
                    ".git/config",
                    ".git/description",
                    ".git/hooks",
                    ".git/index",
                    ".git/info",
                    ".git/logs",
                    ".git/objects",
                    ".git/packed-refs",
                    ".git/refs",
                    ".vscode",
                    ".vscode/launch.json",
                    ".vscode/settings.json",
                    "README.md",
                    "project.properties",
                    "src",
                    "src/buzz.cpp",
                    "src/buzz.ino",
                    "target",
                    "target/3.0.0"
                ]
            }
        ]
    },
    "cli": {
        "binpath": "/Users/username/.vscode/extensions/particle.particle-vscode-core-1.13.9/src/cli/bin/darwin/amd64/particle",
        "ok": true,
        "version": "2.12.0",
        "installed": 1623622309278
    },
    "localCompiler": {
        "ok": true,
        "dependencies": [
            {
                "id": "deviceOS@3.0.0",
                "ok": true
            },
            {
                "id": "gcc-arm@9.2.1",
                "ok": true
            },
            {
                "id": "buildtools@1.1.1",
                "ok": true
            },
            {
                "id": "buildscripts@1.10.0",
                "ok": true
            },
            {
                "id": "openocd@0.11.2-adhoc6ea4372.0",
                "ok": true
            },
            {
                "id": "deviceOS@2.1.0",
                "ok": true
            },
            {
                "id": "deviceOS@2.0.1",
                "ok": true
            },
            {
                "id": "deviceOS@2.0.0",
                "ok": true
            }
        ]
    },
    "platform": {
        "os": "darwin",
        "type": "Darwin",
        "release": "20.4.0",
        "arch": "x64",
        "path": {
            "key": "PATH",
            "value": "/Users/username/.pyenv/shims:/Users/username/.nvm/versions/node/v12.13.1/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin:/Users/username/.sdkman/candidates/gradle/current/bin:/Users/username/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/username/.ebcli-virtual-env/executables:~/Library/Android/sdk/build-tools/28.0.1:/Users/username/Library/Android/sdk/tools:/Users/username/Library/Android/sdk/platform-tools:/Users/username/Library/Android/sdk/tools:/Users/username/Library/Android/sdk/tools/bin/:/Users/username/Library/Android/sdk/platform-tools:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/username/Library/Python/2.7/bin",
            "entries": [
                "/Users/username/.pyenv/shims",
                "/Users/username/.nvm/versions/node/v12.13.1/bin",
                "/usr/local/bin",
                "/usr/local/sbin",
                "/usr/local/bin",
                "/usr/local/sbin",
                "/Users/username/.sdkman/candidates/gradle/current/bin",
                "/Users/username/bin",
                "/usr/local/bin",
                "/usr/bin",
                "/bin",
                "/usr/sbin",
                "/sbin",
                "/usr/local/share/dotnet",
                "~/.dotnet/tools",
                "/Library/Apple/usr/bin",
                "/Library/Frameworks/Mono.framework/Versions/Current/Commands",
                "/Users/username/.ebcli-virtual-env/executables",
                "~/Library/Android/sdk/build-tools/28.0.1",
                "/Users/username/Library/Android/sdk/tools",
                "/Users/username/Library/Android/sdk/platform-tools",
                "/Users/username/Library/Android/sdk/tools",
                "/Users/username/Library/Android/sdk/tools/bin/",
                "/Users/username/Library/Android/sdk/platform-tools",
                "/Applications/Postgres.app/Contents/Versions/latest/bin",
                "/Users/username/Library/Python/2.7/bin"
            ]
        },
        "homeDir": "/Users/username",
        "particleDir": "/Users/username/.particle",
        "particleToolchainDir": "/Users/username/.particle/toolchains"
    },
    "env": {
        "ELECTRON_RUN_AS_NODE": "1",
        "USER": "username",
        "__CFBundleIdentifier": "com.microsoft.VSCode",
        "COMMAND_MODE": "unix2003",
        "LOGNAME": "username",
        "PATH": "/Users/username/.pyenv/shims:/Users/username/.nvm/versions/node/v12.13.1/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin:/Users/username/.sdkman/candidates/gradle/current/bin:/Users/username/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/username/.ebcli-virtual-env/executables:~/Library/Android/sdk/build-tools/28.0.1:/Users/username/Library/Android/sdk/tools:/Users/username/Library/Android/sdk/platform-tools:/Users/username/Library/Android/sdk/tools:/Users/username/Library/Android/sdk/tools/bin/:/Users/username/Library/Android/sdk/platform-tools:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/username/Library/Python/2.7/bin",
        "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.wfkTJHTg6u/Listeners",
        "SHELL": "/bin/zsh",
        "HOME": "/Users/username",
        "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
        "TMPDIR": "/var/folders/4c/szsln9m15gs5tmfs8gg7qfdw0000gn/T/",
        "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.80838265.80838271",
        "XPC_FLAGS": "0x0",
        "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
        "VSCODE_CWD": "/",
        "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
        "VSCODE_NODE_CACHED_DATA_DIR": "/Users/username/Library/Application Support/Code/CachedData/507ce72a4466fbb27b715c3722558bb15afa9f48",
        "VSCODE_IPC_HOOK": "/Users/username/Library/Application Support/Code/1.57.1-main.sock",
        "VSCODE_PID": "1969",
        "SHLVL": "0",
        "PWD": "/",
        "OLDPWD": "/",
        "ZSH": "/Users/username/.oh-my-zsh",
        "PAGER": "less",
        "LESS": "-R",
        "LSCOLORS": "Gxfxcxdxbxegedabagacad",
        "SDKMAN_DIR": "/Users/username/.sdkman",
        "SDKMAN_PLATFORM": "Darwin",
        "SDKMAN_VERSION": "5.7.2+323",
        "SDKMAN_CANDIDATES_API": "https://api.sdkman.io/2",
        "SDKMAN_CANDIDATES_DIR": "/Users/username/.sdkman/candidates",
        "GRADLE_HOME": "/Users/username/.sdkman/candidates/gradle/current",
        "ANDROID_HOME": "/Users/username/Library/Android/sdk",
        "PYTHONPATH": "/Users/username/Library/Python/2.7/bin",
        "NVM_DIR": "/Users/username/.nvm",
        "NVM_CD_FLAGS": "-q",
        "NVM_BIN": "/Users/username/.nvm/versions/node/v12.13.1/bin",
        "NVM_INC": "/Users/username/.nvm/versions/node/v12.13.1/include/node",
        "PYENV_SHELL": "zsh",
        "_": "/Users/username/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
        "VSCODE_AMD_ENTRYPOINT": "vs/workbench/services/extensions/node/extensionHostProcess",
        "VSCODE_PIPE_LOGGING": "true",
        "VSCODE_VERBOSE_LOGGING": "true",
        "VSCODE_LOG_NATIVE": "false",
        "VSCODE_IPC_HOOK_EXTHOST": "/var/folders/4c/szsln9m15gs5tmfs8gg7qfdw0000gn/T/vscode-ipc-af08db05-b214-4e76-b98b-914fdfae07ff.sock",
        "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
        "VSCODE_LOG_STACK": "false",
        "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true",
        "WALLABY_PRODUCTION": "true"
    },
    "versions": {
        "node": "14.16.0",
        "v8": "8.9.255.25-electron.0",
        "uv": "1.40.0",
        "zlib": "1.2.11",
        "brotli": "1.0.9",
        "ares": "1.16.1",
        "modules": "87",
        "nghttp2": "1.41.0",
        "napi": "7",
        "llhttp": "2.1.3",
        "openssl": "1.1.1",
        "cldr": "38.0",
        "icu": "68.1",
        "tz": "2021a",
        "unicode": "13.0",
        "electron": "12.0.7"
    },
    "vscode": {
        "appName": "Visual Studio Code",
        "appRoot": "/Users/username/Applications/Visual Studio Code.app/Contents/Resources/app",
        "machineId": "3482b860dcb94021612c981330eea3d0dccaf05bedf9a15f0274decf441287bd",
        "sessionId": "7379f1f7-771d-4f39-8648-42f0f42ca1691625190688362",
        "version": "1.57.1"
    },
    "extensions": [
        {
            "id": "ms-vscode.js-debug",
            "version": "1.57.0"
        },
        {
            "id": "ms-vscode.js-debug-companion",
            "version": "1.0.13"
        },
        {
            "id": "ms-vscode.node-debug",
            "version": "1.44.28"
        },
        {
            "id": "ms-vscode.node-debug2",
            "version": "1.42.7"
        },
        {
            "id": "ms-vscode.references-view",
            "version": "0.0.80"
        },
        {
            "id": "ms-vscode.vscode-js-profile-table",
            "version": "0.0.18"
        },
        {
            "id": "alefragnani.Bookmarks",
            "version": "13.1.0"
        },
        {
            "id": "Angular.ng-template",
            "version": "12.1.1"
        },
        {
            "id": "arturock.gitstash",
            "version": "3.3.1"
        },
        {
            "id": "aws-scripting-guy.cform",
            "version": "0.0.24"
        },
        {
            "id": "batisteo.vscode-django",
            "version": "1.6.0"
        },
        {
            "id": "bibhasdn.django-html",
            "version": "1.3.0"
        },
        {
            "id": "christian-kohler.npm-intellisense",
            "version": "1.3.1"
        },
        {
            "id": "CoenraadS.bracket-pair-colorizer",
            "version": "1.0.61"
        },
        {
            "id": "DanielThielking.aws-cloudformation-yaml",
            "version": "0.2.2"
        },
        {
            "id": "dbaeumer.vscode-eslint",
            "version": "2.1.23"
        },
        {
            "id": "donjayamanne.python-extension-pack",
            "version": "1.6.0"
        },
        {
            "id": "DotJoshJohnson.xml",
            "version": "2.5.1"
        },
        {
            "id": "eamodio.gitlens",
            "version": "11.5.1"
        },
        {
            "id": "EditorConfig.EditorConfig",
            "version": "0.16.4"
        },
        {
            "id": "eg2.tslint",
            "version": "1.0.47"
        },
        {
            "id": "eg2.vscode-npm-script",
            "version": "0.3.22"
        },
        {
            "id": "esbenp.prettier-vscode",
            "version": "8.0.1"
        },
        {
            "id": "exiasr.hadolint",
            "version": "1.0.2"
        },
        {
            "id": "GrapeCity.gc-excelviewer",
            "version": "3.0.42"
        },
        {
            "id": "HookyQR.beautify",
            "version": "1.5.0"
        },
        {
            "id": "in4margaret.compareit",
            "version": "0.0.2"
        },
        {
            "id": "joaompinto.vscode-graphviz",
            "version": "0.0.6"
        },
        {
            "id": "johnpapa.angular-essentials",
            "version": "12.0.0"
        },
        {
            "id": "johnpapa.Angular2",
            "version": "12.0.0"
        },
        {
            "id": "johnpapa.vscode-peacock",
            "version": "3.9.1"
        },
        {
            "id": "johnpapa.winteriscoming",
            "version": "1.4.4"
        },
        {
            "id": "kdcro101.favorites",
            "version": "2.4.5"
        },
        {
            "id": "magicstack.MagicPython",
            "version": "1.1.0"
        },
        {
            "id": "marus25.cortex-debug",
            "version": "0.3.12"
        },
        {
            "id": "mathiasfrohlich.Kotlin",
            "version": "1.7.1"
        },
        {
            "id": "mhutchie.git-graph",
            "version": "1.30.0"
        },
        {
            "id": "mrmlnc.vscode-attrs-sorter",
            "version": "2.1.0"
        },
        {
            "id": "ms-azuretools.vscode-azureappservice",
            "version": "0.22.0"
        },
        {
            "id": "ms-azuretools.vscode-azurefunctions",
            "version": "1.4.0"
        },
        {
            "id": "ms-azuretools.vscode-azureresourcegroups",
            "version": "0.4.0"
        },
        {
            "id": "ms-azuretools.vscode-docker",
            "version": "1.14.0"
        },
        {
            "id": "ms-python.python",
            "version": "2021.6.944021595"
        },
        {
            "id": "ms-python.vscode-pylance",
            "version": "2021.6.3"
        },
        {
            "id": "ms-toolsai.jupyter",
            "version": "2021.6.999662501"
        },
        {
            "id": "ms-vscode-remote.remote-containers",
            "version": "0.183.0"
        },
        {
            "id": "ms-vscode-remote.remote-ssh",
            "version": "0.65.7"
        },
        {
            "id": "ms-vscode-remote.remote-ssh-edit",
            "version": "0.65.7"
        },
        {
            "id": "ms-vscode-remote.remote-wsl",
            "version": "0.56.5"
        },
        {
            "id": "ms-vscode-remote.vscode-remote-extensionpack",
            "version": "0.21.0"
        },
        {
            "id": "ms-vscode.azure-account",
            "version": "0.9.8"
        },
        {
            "id": "ms-vscode.cpptools",
            "version": "1.4.1"
        },
        {
            "id": "ms-vsliveshare.vsliveshare",
            "version": "1.0.4498"
        },
        {
            "id": "msjsdiag.cordova-tools",
            "version": "2.2.3"
        },
        {
            "id": "msjsdiag.debugger-for-chrome",
            "version": "4.12.12"
        },
        {
            "id": "msjsdiag.debugger-for-edge",
            "version": "1.0.15"
        },
        {
            "id": "msjsdiag.vscode-react-native",
            "version": "1.5.1"
        },
        {
            "id": "nrwl.angular-console",
            "version": "17.6.1"
        },
        {
            "id": "octref.vetur",
            "version": "0.34.1"
        },
        {
            "id": "particle.particle-vscode-core",
            "version": "1.13.9"
        },
        {
            "id": "particle.particle-vscode-pack",
            "version": "1.13.9"
        },
        {
            "id": "particle.particle-vscode-snippets",
            "version": "1.13.9"
        },
        {
            "id": "particle.particle-vscode-theme",
            "version": "1.13.9"
        },
        {
            "id": "PascalReitermann93.vscode-yaml-sort",
            "version": "4.2.0"
        },
        {
            "id": "PKief.material-icon-theme",
            "version": "4.7.0"
        },
        {
            "id": "redhat.vscode-yaml",
            "version": "0.20.0"
        },
        {
            "id": "sdras.night-owl",
            "version": "2.0.0"
        },
        {
            "id": "sdras.vue-vscode-extensionpack",
            "version": "0.2.0"
        },
        {
            "id": "sdras.vue-vscode-snippets",
            "version": "2.2.0"
        },
        {
            "id": "sysoev.language-stylus",
            "version": "1.11.0"
        },
        {
            "id": "TabNine.tabnine-vscode",
            "version": "3.4.12"
        },
        {
            "id": "tombonnike.vscode-status-bar-format-toggle",
            "version": "2.0.0"
        },
        {
            "id": "VisualStudioExptTeam.vscodeintellicode",
            "version": "1.2.14"
        },
        {
            "id": "WallabyJs.quokka-vscode",
            "version": "1.0.383"
        },
        {
            "id": "wholroyd.jinja",
            "version": "0.0.8"
        },
        {
            "id": "wmaurer.vscode-jumpy",
            "version": "0.3.1"
        },
        {
            "id": "xabikos.JavaScriptSnippets",
            "version": "1.8.0"
        }
    ]
}

I’d guess that you have a .cpp file and did not add at the top:

#include "Particle.h"

It’s one of the things that’s handled automatically when creating a .ino file, but required for .cpp files.

3 Likes