RCswitch complie error

Does anyone else have any compiling error with RCSwitch library?
I’m just using the example code * [ReceiveDemo_Advanced.ino] and I get following errors

lib/RCSwitch/RCSwitch.cpp:250:12: invalid conversion from 'char' to 'char*' [-fpermissive]
lib/RCSwitch/RCSwitch.cpp:323:12: invalid conversion from 'char' to 'char*' [-fpermissive]
lib/RCSwitch/RCSwitch.cpp:388:20: invalid conversion from 'char' to 'char*' [-fpermissive]
lib/RCSwitch/RCSwitch.cpp:408:20: invalid conversion from 'char' to 'char*' [-fpermissive]

and this is the raw

Processing  receivedemo_advanced.ino
Checking library RCSwitch...
Installing library RCSwitch 2.5.2 to lib/RCSwitch ...
Library RCSwitch 2.5.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/receivedemo_advanced.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 -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.1.0 -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 -Isrc -I./libraries -Ilib/RCSwitch/src -I. -MD -MP -MF ../build/target/user/platform-6-msrc/receivedemo_advanced.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,2101 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -flto -ffat-lto-objects -DPARTICLE_COMPILE_LTO_FAT -std=gnu++14 -c -o ../build/target/user/platform-6-msrc/receivedemo_advanced.o src/receivedemo_advanced.cpp
receivedemo_advanced.ino: In function 'char* bin2tristate(char*)':
receivedemo_advanced.ino:39:10: warning: address of local variable 'returnValue' returned [-Wreturn-local-addr]
receivedemo_advanced.ino:19:8: note: declared here
receivedemo_advanced.ino: In function 'void output(long unsigned int, unsigned int, unsigned int, unsigned int*, unsigned int)':
receivedemo_advanced.ino:64:5: warning: 'Spark' is deprecated: Spark is now Particle. [-Wdeprecated-declarations]
In file included from ../wiring/inc/spark_wiring.h:50,
                 from ./inc/application.h:42,
                 from src/receivedemo_advanced.cpp:1:
../wiring/inc/spark_wiring_cloud.h:512:19: note: declared here
  512 | extern CloudClass Spark __attribute__((deprecated("Spark is now Particle.")));
      |                   ^~~~~

Building cpp file: lib/RCSwitch/src/RCSwitch.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-6-mRCSwitch/src/
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.1.0 -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 -Isrc -I./libraries -Ilib/RCSwitch/src -I. -MD -MP -MF ../build/target/user/platform-6-mRCSwitch/src/RCSwitch.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,2101 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -flto -ffat-lto-objects -DPARTICLE_COMPILE_LTO_FAT -std=gnu++14 -c -o ../build/target/user/platform-6-mRCSwitch/src/RCSwitch.o lib/RCSwitch/src/RCSwitch.cpp
lib/RCSwitch/src/RCSwitch.cpp: In member function 'char* RCSwitch::getCodeWordB(int, int, bool)':
lib/RCSwitch/src/RCSwitch.cpp:250:12: error: invalid conversion from 'char' to 'char*' [-fpermissive]
  250 |     return '\0';
      |            ^~~~
      |            |
      |            char
lib/RCSwitch/src/RCSwitch.cpp: In member function 'char* RCSwitch::getCodeWordC(char, int, int, bool)':
lib/RCSwitch/src/RCSwitch.cpp:323:12: error: invalid conversion from 'char' to 'char*' [-fpermissive]
  323 |     return '\0';
      |            ^~~~
      |            |
      |            char
lib/RCSwitch/src/RCSwitch.cpp: In member function 'char* RCSwitch::getCodeWordD(char, int, bool)':
lib/RCSwitch/src/RCSwitch.cpp:388:20: error: invalid conversion from 'char' to 'char*' [-fpermissive]
  388 |             return '\0';
      |                    ^~~~
      |                    |
      |                    char
lib/RCSwitch/src/RCSwitch.cpp:408:20: error: invalid conversion from 'char' to 'char*' [-fpermissive]
  408 |             return '\0';
      |                    ^~~~
      |                    |
      |                    char
../build/module.mk:286: recipe for target '../build/target/user/platform-6-mRCSwitch/src/RCSwitch.o' failed
make[2]: *** [../build/target/user/platform-6-mRCSwitch/src/RCSwitch.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: *** [user] Error 2
make[1]: Leaving directory '/firmware/modules/photon/user-part'
../build/recurse.mk:11: recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

Does anyone know how I can fix this? is there any other library to use to receive RF 433 learning code remote controls?
I was able to make it work with arduino and RCswitch library to receive the codes and do actions accordingly but I keep getting this error on particle , I searched all over internet and I couldn’t find any solution
thank you in advance for taking a look on this topic

Frankly, the library is written pretty poorly. However, I managed to get it to compile on my machine by fixing a few return statements. As indicated in the compiler output, there are several functions that are supposed to return char* (pointer to char) but return a char instead:

lib/RCSwitch/RCSwitch.cpp:250:12: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]

lib/RCSwitch/RCSwitch.cpp:323:12: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]

lib/RCSwitch/RCSwitch.cpp:388:20: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]

lib/RCSwitch/RCSwitch.cpp:408:20: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]

By changing the return values from '\0' to NULL on lines 250, 323, 388, and 408 of RCSwitch.cpp the error is resolved:

return '\0'; // Error

return NULL; // No error
2 Likes

Yes, that worked
thank you very much for your help I really appreciate it
you mentioned the library is written poorly
is the any better library to just receive 433 RF signals from a remote control?

1 Like

I’m not familar with any other libraries for 433MHz remotes. If the library works well enough for your project you shouldn’t bother worrying about it.