Error compiling using commands

Good morning everyone. I’m trying to compile my code through the command: “particle compile photon DS18B20.ino” and I’m not getting success. I created the project and added the libraries using the commands “particle project create” and “particle library add …” and everything went without errors. In IDE by interner the program compiles normally and writes to flash, however, when I try to record using the command “particle compile photon …” it gives the following error: "DS18B20.ino: 8: 10: fatal error: PollingTimer.h : No such file or directory “followed by another error” Error 2
…/build/ recipe for target ‘modules / photon / user-part’ failed
make: *** [modules / photon / user-part] Error 2 "the tricky thing is that the IDE on the interner compiles normally.

Your compile command will only (try to) compile that one file you referenced but as you stated that you created a project and added libraries to that project you need to compile the entire project.

Try particle compile photon . (dot stands for current directory) while inside the project folder where resides, then it should work.

1 Like

Thanks for the answer. I had already done that. I am forming the command inside the directory where the project was created and even so it still gives an error.

Can you post the full log of that build command (including the command itself).

Compiling code for photon


attempting to compile firmware
Compile failed: Processing  DS18B20.ino
make -C ../modules/photon/user-part all
make[1]: Entering directory '/firmware/modules/photon/user-part'
make -C ../../../user
make[2]: Entering directory '/firmware/user'
Building cpp file: DS18B20.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-6-m
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DPLATFORM_GEN=2 -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb --specs=nano.specs -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=6 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=2.0.1 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../third_party/nanopb/nanopb -I../communication/inc -I../hal/inc -I../hal/shared -I../hal/src/photon -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/network/util -I../hal/network -I../hal/src/photon/api -I../hal/src/photon/include -I../hal/src/photon/wiced/security/BESL/host/WICED/ -I../hal/src/photon/wiced/security/BESL/include -I../hal/src/photon/wiced/security/BESL -I../hal/src/photon/wiced/security/BESL/crypto -I../hal/src/photon/wiced/WWD/include/ -I../hal/src/photon/wiced/platform/include/ -I../hal/src/photon/wiced/platform/GCC/ -I../hal/src/photon/wiced/security/BESL/supplicant/ -I../hal/src/photon/libraries/crypto -I../hal/src/photon/libraries/daemons/DNS_redirect -I../third_party/miniz/miniz -I../platform/shared/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../dynalib/inc -I -I./libraries -I. -MD -MP -MF ../build/target/user/platform-6-mDS18B20.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 -DBOOTLOADER_SDK_3_3_0_PARTICLE -DPARTICLE_DCT_COMPATIBILITY -DSPARK_PLATFORM_NET=BCM9WCDUSI09 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x80A0000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,2011 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -std=gnu++14 -c -o ../build/target/user/platform-6-mDS18B20.o DS18B20.cpp
DS18B20.ino:8:10: fatal error: PollingTimer.h: No such file or directory
    8 | #include <PollingTimer.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
../build/ recipe for target '../build/target/user/platform-6-mDS18B20.o' failed
make[2]: *** [../build/target/user/platform-6-mDS18B20.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/ recipe for target 'user' failed
make[1]: *** [user] Error 2
make[1]: Leaving directory '/firmware/modules/photon/user-part'
../build/ recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

The above error is what happens when I try to compile the code

Obviously some parts of my request didn’t make it into your last post

From what I see you are not using the correct command otherwise this would list a whole lot more files

As it does not my original statement still stands

the command I proposed would do a whole lot more than that.