Can't compile because of 'particle::SPISettings' and make errors

Hello readers,

I am incredibly new to Particle and it’s Workbench. As well as using VS Code in general. About a month ago, while following a tutorial, I had been learning and getting my Particle Projects to both compile and flash to my argon device.

Now starting about a week ago, after downloading and working on an existing repository for work, my code is no longer compiling fully and is terminating with exit code: 2. This repository was originally made to work on a photon, which it had done so on another computer, but may have somehow altered libraries within the Particle Workbench, or so I’m led to believe.

I have followed these steps Intellisense: Report Issues Here as well as these Updating from v1.3.x to v1.4.1 (or greater) hoping that one of which will revert my results back to how I had before.

Posted below is my minimal code that would crash the program and the Terminal following it:

SYSTEM_MODE(MANUAL);
#include <iostream>
#include <cmath>
void setup() {
  Serial.begin(9600);
  Serial.println("Hello World!");
void loop() {
}

And the Terminal:

> Executing task: make -f 'C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile' compile-user -s <

src/spark_wiring_spi.cpp:38:18: error: invalid abstract return type 'particle::__SPISettings'
 static particle::__SPISettings spiSettingsFromSpiInfo(hal_spi_info_t* info)
                  ^
In file included from src/spark_wiring_spi.cpp:27:0:
./inc/spark_wiring_spi.h:51:7: note:   because the following virtual functions are pure within 'particle::__SPISettings':
 class __SPISettings : public Printable {
       ^
In file included from ./inc/spark_wiring_print.h:36:0,
                 from ./inc/spark_wiring_string.h:34,
                 from ./inc/spark_wiring_stream.h:30,
                 from ./inc/spark_wiring.h:38,
                 from ./inc/spark_wiring_spi.h:30,
                 from src/spark_wiring_spi.cpp:27:
./inc/spark_wiring_printable.h:43:20: note:     virtual size_t Printable::printTo(Print&) const
     virtual size_t printTo(Print& p) const = 0;
                    ^
src/spark_wiring_spi.cpp: In function 'particle::__SPISettings spiSettingsFromSpiInfo(hal_spi_info_t*)':
src/spark_wiring_spi.cpp:38:32: error: invalid abstract return type for function 'particle::__SPISettings spiSettingsFromSpiInfo(hal_spi_info_t*)'
 static particle::__SPISettings spiSettingsFromSpiInfo(hal_spi_info_t* info)
                                ^
src/spark_wiring_spi.cpp:41:36: error: invalid cast to abstract class type 'particle::__SPISettings'
     return particle::__SPISettings();
                                    ^
src/spark_wiring_spi.cpp:42:79: error: invalid cast to abstract class type 'particle::__SPISettings'
   return particle::__SPISettings(info->clock, info->bit_order, info->data_mode);
                                                                               ^
src/spark_wiring_spi.cpp: In member function 'int32_t SPIClass::beginTransaction(const particle::__SPISettings&)':
src/spark_wiring_spi.cpp:107:65: error: cannot allocate an object of abstract type 'particle::__SPISettings'
   particle::__SPISettings current = spiSettingsFromSpiInfo(&info);
                                                                 ^
src/spark_wiring_spi.cpp:107:27: error: cannot declare variable 'current' to be of abstract type 'particle::__SPISettings'
   particle::__SPISettings current = spiSettingsFromSpiInfo(&info);
                           ^
make[3]: *** [../build/module.mk:265: ../build/target/wiring/platform-6-m/src/spark_wiring_spi.o] Error 1
make[2]: *** [../../../build/recurse.mk:12: wiring] Error 2
make[1]: *** [../build/recurse.mk:12: modules/photon/user-part] Error 2
make: *** [C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile:46: compile-user] Error 2
The terminal process terminated with exit code: 2

Press any key to close the terminal.

Also, one last relevant note, after heading on to the problems tab I was asked if I wanted a spark_wiring_spi.cpp file created because it was missing, so I hit yes and now I have an empty spark_wiring_spi.cpp file open.

Again, I am incredibly new to Particle and VS Code, thus am not even sure if I this would be actually be VS Code or Windows problem instead. I would appreciate any advice or tutorials sent my way!

Your code is missing a closing curly brace for setup().
Have you tried adding #include <Particle.h> as first statement?
Did you create the project via the respective image command and set the target via image ?
Make sure to select a fairly recent device OS version.

If you have issues with your build environment you can always run image and then image

1 Like

adding to what @ScruffR said, before running Particle: Reset Environment, run Particle: Audit Environment and review the report it generates to see if you spot any fields like ok: false.

from there Particle: Reset Environment will almost always clean things up but if not re-run the audit and share the report here so we have a better view into what might be happening.

1 Like

I forgot to copy down that last curly bracket for the first post. Thank you for continuing on to other possible causes.

Right now I have gotten a new issue, different but new! I didn’t think any change would ever occur again. I had not ran a Particle: Audit Environment beforehand, but have done so earlier in the week. Where CLI had an “ok”: false, is now “ok”:true! “localCompiler” still has an “ok”: false as well as one of its dependencies, “buildtools@1.1.0”. None else otherwise.

The new Terminal is:

> Executing task: make -f 'C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile' compile-user -s <

bash.exe: warning: could not find /tmp, please create!
/usr/bin/bash: make: command not found
The terminal process command 'C:\Users\jhdil\.particle\toolchains\buildtools\1.1.0\bin\bash.exe -c 'make -f 'C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile' compile-user -s'' failed to launch (exit code: 127)

Press any key to close the terminal.

That make file location has appeared before. It normally directs me to lines 42 and 46 of the make file, but now its defaulting to just the first line. I guess neither lines 42 or 46 of the make file are causing an issue any more?

someone else ran into this a while back:

does the C:\Users\jhdil\.particle\toolchains\buildtools\1.1.0\tmp directory exist?

if not, please run Particle: Reset Environment, let the install process complete, and check to see whether or not the C:\Users\jhdil\.particle\toolchains\buildtools\1.1.0\tmp directory was added.

As a matter of fact, C:\Users\jhdil.particle\toolchains\buildtools\1.1.0\tmp does not seem to exist. When I try to follow the path in both a file explorer and in a Git Bash, I am only able to get into 1.1.0 and find nothing other than a ‘bin’ folder and the contents within it. I had done another Particle: Reset Environment, looked down the file explorer again, and found that tmp was still missing. :face_with_raised_eyebrow:

Within the bin folder: bash.exe, cygintl-8.dll, cygreadline7.dll, cygiconv-2.dll, cygncursesw-10.dll, and cygwin1.dll

What do I do now with this information? Was the tmp directory hidden somehow?

something is preventing the installation from completing. are you running anti-virus software? if so, try disabling it. do you see an error notification within VSCode? if so, please share the error details here. if not, does the installation report success? within VSCode, click the bell icon at the bottom-right to see all notifications.

you can also try the following:

  1. close VSCode
  2. delete the C:\Users\jhdil\.particle\toolchains\buildtools directory
  3. open VSCode
  4. when prompted to install Workbench dependencies, click “install”

if you see a message like:

installation success notification

…and the ./tmp directory is still missing, then we have a bit of a mystery i’m afraid.

please share your findings :pray::+1:

oh, i should add: at this point it’d be really helpful to see the report that Particle: Audit Environment creates. if you are comfortable sharing some or all of it, please post it here.

fwiw, the most interesting report sections (keys) in this context are workspace, cli, localCompiler, platform, vscode, and extensions.

thanks again :pray:

The first time using Particle, I was warned about my Anti-Virus software. Compilation with it would take nearly an hour for simple scripts! So now I keep it turned off when I work on VS Code in general. The anti-virus software is called Trend Micro in case you are interested.

Upon startup, I did not receive specifically a notification like the one you showed, but I did get a “Please Install Particle Dependencies” message. Which then led to Installing Toolchain and Downloading CLI Dependencies, which was seen at the bottom right corner of the screen.

The Terminal has unfortunately reverted back to its original self with:

> Executing task: make -f 'C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile' compile-user -s <

c:/Users/jhdil/OneDrive/Desktop/JHD_Bootcamp_Scratch/Learning/Camera_Hello_World/Hello_World/src/Hello_World.ino:1:12: error: expected constructor, destructor, or type conversion before '(' token
 SYSTEM_MODE(MANUAL);
            ^
make[3]: *** [../build/module.mk:277: ../build/target/user/platform-6-m/Hello_World/src/Hello_World.o] Error 1
make[2]: *** [../../../build/recurse.mk:12: user] Error 2
make[1]: *** [../build/recurse.mk:12: modules/photon/user-part] Error 2
make: *** [C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile:46: compile-user] Error 2
The terminal process terminated with exit code: 2

Press any key to close the terminal.

The Audit Environment Output is:

*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

{
    "username": "jhdillenb@gmail.com",
    "workspace": {
        "name": "Hello_World",
        "isWorkspace": false,
        "folders": [
            {
                "location": "c:\\Users\\jhdil\\OneDrive\\Desktop\\JHD_Bootcamp_Scratch\\Learning\\Camera_Hello_World\\Hello_World",
                "hasValidPath": true,
                "settings": {
                    "firmwareName": "deviceOS",
                    "firmwareVersion": "1.3.0-rc.1",
                    "targetDevice": "",
                    "targetPlatform": "photon",
                    "compileButtonAction": "localAppDeviceOS",
                    "flashButtonAction": "localAppDeviceOS",
                    "disableWelcomeScreen": false,
                    "disableLocalCompilerDirtyCheck": false,
                    "enableVerboseLocalCompilerLogging": false
                },
                "files": [
                    ".vscode",
                    ".vscode\\c_cpp_properties.json",
                    ".vscode\\launch.json",
                    ".vscode\\settings.json",
                    "project.properties",
                    "README.md",
                    "src",
                    "src\\Hello_World.cpp",
                    "src\\Hello_World.ino"
                ]
            }
        ]
    },
    "cli": {
        "binpath": "C:\\Users\\jhdil\\.vscode\\extensions\\particle.particle-vscode-core-1.5.0\\src\\cli\\bin\\windows\\amd64\\particle.exe",
        "ok": true,
        "version": "1.43.1",
        "installed": 1563469148684
    },
    "localCompiler": {
        "ok": true,
        "dependencies": [
            {
                "id": "deviceOS@1.3.0-rc.1",
                "ok": true
            },
            {
                "id": "gcc-arm@5.3.1",
                "ok": true
            },
            {
                "id": "buildtools@1.1.0",
                "ok": true
            },
            {
                "id": "buildscripts@1.6.1",
                "ok": true
            },
            {
                "id": "openocd@0.11.1-adhoc6ea4372.0",
                "ok": true
            }
        ]
    },
    "platform": {
        "os": "windows",
        "type": "Windows_NT",
        "release": "10.0.17134",
        "arch": "x64",
        "path": {
            "key": "Path",
            "value": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\Git\\cmd;C:\\Users\\jhdil\\OneDrive\\Desktop\\Old_COD_C++_Stuff\\mingw32\\bin;C:\\Program Files\\MySQL\\MySQL Shell 8.0\\bin\\;C:\\Users\\jhdil\\Anaconda3;C:\\Users\\jhdil\\Anaconda3\\Scripts;C:\\Users\\jhdil\\Anaconda3\\condabin;C:\\Users\\jhdil\\Anaconda3\\libs;C:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"
        },
        "homeDir": "C:\\Users\\jhdil",
        "particleDir": "C:\\Users\\jhdil\\.particle",
        "localCompilerToolchainDir": "C:\\Users\\jhdil\\.particle\\toolchains"
    },
    "env": {
        "ALLUSERSPROFILE": "C:\\ProgramData",
        "AMD_ENTRYPOINT": "vs/workbench/services/extensions/node/extensionHostProcess",
        "APPDATA": "C:\\Users\\jhdil\\AppData\\Roaming",
        "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true",
        "CommonProgramFiles": "C:\\Program Files\\Common Files",
        "CommonProgramFiles(x86)": "C:\\Program Files (x86)\\Common Files",
        "CommonProgramW6432": "C:\\Program Files\\Common Files",
        "COMPUTERNAME": "DESKTOP-IVRLSBC",
        "ComSpec": "C:\\Windows\\system32\\cmd.exe",
        "DriverData": "C:\\Windows\\System32\\Drivers\\DriverData",
        "ELECTRON_RUN_AS_NODE": "1",
        "HOMEDRIVE": "C:",
        "HOMEPATH": "\\Users\\jhdil",
        "LOCALAPPDATA": "C:\\Users\\jhdil\\AppData\\Local",
        "LOGONSERVER": "\\\\DESKTOP-IVRLSBC",
        "NUMBER_OF_PROCESSORS": "8",
        "OneDrive": "C:\\Users\\jhdil\\OneDrive",
        "OneDriveConsumer": "C:\\Users\\jhdil\\OneDrive",
        "OS": "Windows_NT",
        "Path": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\Git\\cmd;C:\\Users\\jhdil\\OneDrive\\Desktop\\Old_COD_C++_Stuff\\mingw32\\bin;C:\\Program Files\\MySQL\\MySQL Shell 8.0\\bin\\;C:\\Users\\jhdil\\Anaconda3;C:\\Users\\jhdil\\Anaconda3\\Scripts;C:\\Users\\jhdil\\Anaconda3\\condabin;C:\\Users\\jhdil\\Anaconda3\\libs;C:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
        "PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC",
        "PIPE_LOGGING": "true",
        "PROCESSOR_ARCHITECTURE": "AMD64",
        "PROCESSOR_IDENTIFIER": "Intel64 Family 6 Model 142 Stepping 10, GenuineIntel",
        "PROCESSOR_LEVEL": "6",
        "PROCESSOR_REVISION": "8e0a",
        "ProgramData": "C:\\ProgramData",
        "ProgramFiles": "C:\\Program Files",
        "ProgramFiles(x86)": "C:\\Program Files (x86)",
        "ProgramW6432": "C:\\Program Files",
        "PSModulePath": "C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules",
        "PUBLIC": "C:\\Users\\Public",
        "SESSIONNAME": "Console",
        "SystemDrive": "C:",
        "SystemRoot": "C:\\Windows",
        "TEMP": "C:\\Users\\jhdil\\AppData\\Local\\Temp",
        "TMP": "C:\\Users\\jhdil\\AppData\\Local\\Temp",
        "USERDOMAIN": "DESKTOP-IVRLSBC",
        "USERDOMAIN_ROAMINGPROFILE": "DESKTOP-IVRLSBC",
        "USERNAME": "jhdil",
        "USERPROFILE": "C:\\Users\\jhdil",
        "VERBOSE_LOGGING": "true",
        "VSCODE_CWD": "C:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code",
        "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
        "VSCODE_IPC_HOOK": "\\\\.\\pipe\\a629cbdb9f1fda57ff5d021a25098436-1.36.1-main-sock",
        "VSCODE_IPC_HOOK_EXTHOST": "\\\\.\\pipe\\vscode-ipc-902b715a-077a-4810-9156-2422a7936ebb-sock",
        "VSCODE_LOGS": "C:\\Users\\jhdil\\AppData\\Roaming\\Code\\logs\\20190718T115824",
        "VSCODE_LOG_STACK": "false",
        "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
        "VSCODE_NODE_CACHED_DATA_DIR": "C:\\Users\\jhdil\\AppData\\Roaming\\Code\\CachedData\\2213894ea0415ee8c85c5eea0d0ff81ecc191529",
        "VSCODE_PID": "17584",
        "VSCODE_PREVENT_FOREIGN_INSPECT": "true",
        "windir": "C:\\Windows"
    },
    "versions": {
        "http_parser": "2.8.0",
        "node": "10.11.0",
        "v8": "6.9.427.31-electron.0",
        "uv": "1.23.0",
        "zlib": "1.2.11",
        "ares": "1.14.0",
        "modules": "69",
        "nghttp2": "1.33.0",
        "napi": "3",
        "openssl": "1.1.0",
        "icu": "62.2",
        "unicode": "11.0",
        "cldr": "33.1",
        "tz": "2019a"
    },
    "vscode": {
        "appName": "Visual Studio Code",
        "appRoot": "c:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "machineId": "11d4b23c0da177230f94e37c0615185bb81b8910cf43325b1412c93cf1aee13e",
        "sessionId": "e8560136-9664-4160-9c64-74639b389dd51563469107127",
        "version": "1.36.1"
    },
    "extensions": [
        {
            "id": "ms-vscode.node-debug",
            "version": "1.35.3"
        },
        {
            "id": "ms-vscode.node-debug2",
            "version": "1.33.0"
        },
        {
            "id": "ms-vscode.references-view",
            "version": "0.0.27"
        },
        {
            "id": "austin.code-gnu-global",
            "version": "0.2.2"
        },
        {
            "id": "marus25.cortex-debug",
            "version": "0.3.1"
        },
        {
            "id": "ms-python.anaconda-extension-pack",
            "version": "1.0.1"
        },
        {
            "id": "ms-python.python",
            "version": "2019.6.24221"
        },
        {
            "id": "ms-vscode.cpptools",
            "version": "0.24.0"
        },
        {
            "id": "particle.particle-vscode-core",
            "version": "1.5.0"
        },
        {
            "id": "particle.particle-vscode-pack",
            "version": "1.5.0"
        },
        {
            "id": "particle.particle-vscode-snippets",
            "version": "1.5.0"
        },
        {
            "id": "particle.particle-vscode-theme",
            "version": "1.5.0"
        },
        {
            "id": "vsciot-vscode.vscode-arduino",
            "version": "0.2.27"
        }
    ]
}

*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

On a brighter note, the tmp folder has shown up in my C:\Users\jhdil\.particle\toolchains\buildtools\1.1.0 path! As well as many other folders and a text doc called “ThirdPartyNotices”.

1 Like

ok, so this is actually good news - your cli and localCompiler both report ok: true across the board so you have the required toolchains installed :+1:

as for your error:

c:/Users/jhdil/OneDrive/Desktop/JHD_Bootcamp_Scratch/Learning/Camera_Hello_World/Hello_World/src/Hello_World.ino:1:12: error: expected constructor, destructor, or type conversion before '(' token
 SYSTEM_MODE(MANUAL);

…this appears to be a normal, run-of-the-mill bug in your code :grinning:

if you just want to verify that your env is working properly, you can:

  1. run Particle: Create New Project and follow the prompts
  2. after your new project is created, install default dependencies if prompted
  3. compile your project:
    • from the VSCode main menu, select “Terminal” > “Run task…”
    • select the Particle: Compile application & DeviceOS (local) task
    • wait for the build to complete

lastly, if you haven’t seen them already please check out our docs over here:

https://docs.particle.io/workbench/

I have created a new project and found that it compiles! It takes about a minute, where I thought it would only take maybe 10 seconds, but it compiles. Not only that, but after copying and pasting all of my code from the old project into the new project I ran into the same errors as before. Thus I figured that the problem was in the code. And it was!

It was the library iostream that was the problem!

I didn’t even think that the library I had used in successfully in my C++ scripts on Visual Studio (Not Code) would be what broke Particle. It wasn’t at all what I was expecting to be the problem, but thank you for helping me discover the issue, m_m!

2 Likes