# Local compile error for STARTUP & SYSTEM\_MODE

**URL:** <https://community.particle.io/t/local-compile-error-for-startup-system-mode/35546>\
**Category:** Troubleshooting\
**Created:** [August 23, 2017, 11:19am UTC](https://community.particle.io/t/local-compile-error-for-startup-system-mode/35546 "2017-08-23T11:19:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenschr](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jenschr/32/4792_2.png) [@jenschr](https://community.particle.io/u/jenschr)\
**Post date:** [August 23, 2017, 11:19am UTC](https://community.particle.io/t/local-compile-error-for-startup-system-mode/35546/1 "2017-08-23T11:19:33Z")

</div>

For future reference (so others can search for it):

**Problem:** when compiling locally, you'll get errors for the macros STARTUP and SYSTEM\_MODE as the ouput below.  
**Solution:** #include "application.h" at the top of your main source file.

> Building cpp file: ../../../myproject//src/myproject.cpp  
> Invoking: ARM GCC CPP Compiler  
> mkdir -p ../build/target/user/platform-8-m/myproject/src/  
> arm-none-eabi-gcc -DSTM32\_DEVICE -DSTM32F2XX -DPLATFORM\_THREADING=1 -DPLATFORM\_ID=8 -DPLATFORM\_NAME=photon -DUSBD\_VID\_SPARK=0x2B04 -DUSBD\_PID\_DFU=0xD008 -DUSBD\_PID\_CDC=0xC008 -DSPARK\_PLATFORM -DFLASHEE\_EEPROM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE\_PLATFORM=1 -DPRODUCT\_ID=8 -DPRODUCT\_FIRMWARE\_VERSION=65535 -DUSE\_STDPERIPH\_DRIVER -DDFU\_BUILD\_ENABLE -DSYSTEM\_VERSION\_STRING=0.6.2 -DRELEASE\_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../communication/src -I../hal/inc -I../hal/shared -I../hal/src/photon -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/src/photon/api -I../platform/shared/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../platform/MCU/STM32F2xx/SPARK\_Firmware\_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/STM32\_StdPeriph\_Driver/inc -I../platform/MCU/STM32F2xx/STM32\_USB\_Device\_Driver/inc -I../platform/MCU/STM32F2xx/STM32\_USB\_Host\_Driver/inc -I../platform/MCU/STM32F2xx/STM32\_USB\_OTG\_Driver/inc -I../dynalib/inc -I../../../myproject//src -I./libraries -I../../../myproject//src -I../../../myproject//src -I../../../myproject//src -I../../../myproject//src -I../../../myproject/lib/AccelStepperSpark/src -I../../../myproject/lib/DACx311/src -I../../../myproject/lib/GSL1680/src -I../../../myproject/lib/MAX6639/src -I../../../myproject/lib/MCP3424/src -I../../../myproject/lib/MQTT/src -I../../../myproject/lib/PID/src -I../../../myproject/lib/RA8875/src -I../../../myproject/lib/SparkIntervalTimer/src -I../../../myproject/lib/TCA6408/src -I../../../myproject/lib/spi\_flash/src -I. -MD -MP -MF ../build/target/user/platform-8-m/myproject/src/myproject.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART\_DFU\_FLASHER\_SERIAL\_SPEED=14400 -DSTART\_YMODEM\_FLASHER\_SERIAL\_SPEED=28800 -DSPARK\_PLATFORM\_NET=BCM9WCDUSI14 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DLOG\_INCLUDE\_SOURCE\_INFO=1 -DPARTICLE\_USER\_MODULE -DUSE\_THREADING=0 -DUSE\_THREADING=0 -DUSE\_SPI=SPI -DUSE\_CS=A2 -DUSE\_SPI=SPI -DUSE\_CS=A2 -DUSER\_FIRMWARE\_IMAGE\_SIZE=0x20000 -DUSER\_FIRMWARE\_IMAGE\_LOCATION=0x80A0000 -DMODULAR\_FIRMWARE=1 -DMODULE\_VERSION=4 -DMODULE\_FUNCTION=5 -DMODULE\_INDEX=1 -DMODULE\_DEPENDENCY=4,2,108 -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-8-m/myproject/src/myproject.o ../../../myproject//src/myproject.cpp  
> ../../../myproject//src/myproject.cpp:9:9: error: expected constructor, destructor, or type conversion before '(' token  
> STARTUP(WiFi.selectAntenna(ANT\_EXTERNAL));  
> ^  
> ../../../myproject//src/myproject.cpp:14:13: error: expected constructor, destructor, or type conversion before '(' token  
> SYSTEM\_MODE(MANUAL);

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 23, 2017, 12:05pm UTC](https://community.particle.io/t/local-compile-error-for-startup-system-mode/35546/2 "2017-08-23T12:05:36Z")

</div>

@jenschr, the reason this is needed is that the Web IDE, much like Arduino, runs a pre-processor which, among other things, adds `#include "Particle.h"` to the code. You may also find that you need to rename your application `.ino` file to `.cpp` and that function declarations need to be added at the top of your application. Pre-processors can really spoil us:wink:

---

<div class="post-metadata">

**Author:** ![jenschr](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jenschr/32/4792_2.png) [@jenschr](https://community.particle.io/u/jenschr)\
**Post date:** [August 23, 2017, 12:16pm UTC](https://community.particle.io/t/local-compile-error-for-startup-system-mode/35546/3 "2017-08-23T12:16:38Z")

</div>

Yup. Some minutes ago I added a pull request to the docs for adding these two things 😉  
(I just added it here for reference)
