All IDE compilation fails with "Mesh was not declared in this scope"

One day out of the blue, all of my mesh devices’ code stopped compiling in the cloud IDE, stating “Mesh was not declared in this scope.”

After some investigation, I decided to strip down to the most basic application:

void setup() {
    waitUntil(Mesh.ready);
}

void loop() {}

This fails with:

Processing  testmesh.ino
make -C ../newlib_nano 
make[1]: Entering directory '/firmware/newlib_nano'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/firmware/newlib_nano'
make -C ../user 
make[1]: Entering directory '/firmware/user'
Building cpp file: testmesh.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-0-lto
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F10X_MD -DPLATFORM_THREADING=0 -DPLATFORM_ID=0 -DPLATFORM_NAME=core -DUSBD_VID_SPARK=0x1D50 -DUSBD_PID_DFU=0x607F -DUSBD_PID_CDC=0x607D -DSPARK_PLATFORM -DFLASHEE_EEPROM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -flto -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=0 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=1.0.0 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../services/nanopb -I../communication/src -I../hal/inc -I../hal/shared -I../hal/src/core -I../hal/src/stm32 -I../platform/shared/inc -I../platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F1xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F1xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F1xx/CMSIS/Include -I../platform/MCU/STM32F1xx/CMSIS/Device/ST/Include -I../platform/NET/CC3000/CC3000_Host_Driver -I../dynalib/inc -I -I./libraries -I. -MD -MP -MF ../build/target/user/platform-0-ltotestmesh.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=CC3000 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DMODULE_VERSION=1000 -DMODULE_FUNCTION=3 -DMODULE_DEPENDENCY=0,0,0 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -std=gnu++11 -c -o ../build/target/user/platform-0-ltotestmesh.o testmesh.cpp
In file included from ../wiring/inc/spark_wiring.h:46:0,
                 from ./inc/application.h:40,
                 from testmesh.cpp:1:
testmesh.ino: In lambda function:
testmesh.ino:2:15: error: 'Mesh' was not declared in this scope
     waitUntil(Mesh.ready);
               ^
../wiring/inc/spark_wiring_system.h:445:63: note: in definition of macro 'waitUntil'
 #define waitUntil(condition) System.waitCondition([]{ return (condition)(); })
                                                               ^
../wiring/inc/spark_wiring_system.h: In instantiation of 'static bool SystemClass::waitConditionWhile(Condition, While) [with Condition = setup()::<lambda()>; While = SystemClass::waitCondition(Condition) [with Condition = setup()::<lambda()>]::<lambda()>]':
../wiring/inc/spark_wiring_system.h:254:34:   required from 'static bool SystemClass::waitCondition(Condition) [with Condition = setup()::<lambda()>]'
testmesh.ino:2:5:   required from here
../wiring/inc/spark_wiring_system.h:247:39: error: could not convert '_condition.setup()::<lambda()>()' from 'void' to 'bool'
         while (_while() && !_condition()) {
                                       ^
../wiring/inc/spark_wiring_system.h:247:28: error: in argument to unary !
         while (_while() && !_condition()) {
                            ^
../wiring/inc/spark_wiring_system.h:250:27: error: void value not ignored as it ought to be
         return _condition();
                           ^
../build/module.mk:265: recipe for target '../build/target/user/platform-0-ltotestmesh.o' failed
make[1]: Leaving directory '/firmware/user'
make[1]: *** [../build/target/user/platform-0-ltotestmesh.o] Error 1
../build/recurse.mk:11: recipe for target 'user' failed
make: *** [user] Error 2

Can you make sure you've selected a Mesh device to compile against?

Wasn’t aware that I had to. That fixes it. Thanks!

1 Like