Cpp header extension

The only supported header extension for .cpp files is .h. I’m wondering why?
I’ve tried .hpp .hh .hxx but it does not work.

@mathieug, how are you compiling?

1 Like

I use Particle Desktop IDE.

Here is the response from the server:

Processing  my-project-v1.ino
Checking library MFRC522...
Checking library SparkIntervalTimer...
Checking library DS18B20...
Checking library SparkJson...
Checking library LiquidCrystal_I2C_Spark...
Installing library DS18B20 0.1.5 to lib/DS18B20 ...
Installing library LiquidCrystal_I2C_Spark 1.1.0 to lib/LiquidCrystal_I2C_Spark ...
Library LiquidCrystal_I2C_Spark 1.1.0 installed.
Library DS18B20 0.1.5 installed.
Checking library OneWire...
Installing library OneWire 2.0.1 to lib/OneWire ...
Library OneWire 2.0.1 installed.
Installing library MFRC522 0.1.4 to lib/MFRC522 ...
Installing library SparkIntervalTimer 1.3.7 to lib/SparkIntervalTimer ...
Library SparkIntervalTimer 1.3.7 installed.
Library MFRC522 0.1.4 installed.
Installing library SparkJson 0.0.2 to lib/SparkJson ...
Library SparkJson 0.0.2 installed.
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: src/my-project-v1.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-6-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=6 -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/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_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 -Isrc -I./libraries -Isrc -Isrc -Isrc -Isrc -Ilib/SparkIntervalTimer/src -Ilib/SparkJson/src -Ilib/LiquidCrystal_I2C_Spark/src -Ilib/MFRC522/src -Ilib/DS18B20/src -Ilib/OneWire/src -I. -MD -MP -MF ../build/target/user/platform-6-msrc/my-project-v1.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=BCM9WCDUSI09 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSE_THREADING=0 -DUSE_SPI=SPI -DUSE_CS=A2 -DUSE_SPI=SPI -DUSE_CS=A2 -DUSE_THREADING=0 -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-6-msrc/my-project-v1.o src/my-project-v1.cpp
my-project-v1.ino:7:22: fatal error: MyClass.hpp: No such file or directory
compilation terminated.
../build/module.mk:267: recipe for target '../build/target/user/platform-6-msrc/my-project-v1.o' failed
make[2]: Leaving directory '/firmware/user'
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: Leaving directory '/firmware/modules/photon/user-part'
make[2]: *** [../build/target/user/platform-6-msrc/my-project-v1.o] Error 1
make[1]: *** [user] Error 2
../build/recurse.mk:11: recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

@mathieug, there is no method for “forcing” an include of non .h or .cpp files on the IDE that I know of. With Particle CLI, you can create particle.include and particle.exclude files to force inclusion or exclusion of certain files. @rickkas7, any thoughts?

1 Like