Using the MFRC522.cpp library inside a c project for NodeMCUv3 (ESP8266)

I bought a NodeMCUv3 board to run the following HomeKit code on it, click. This works well, my board is connected to WiFi and I can add it to the Home App as an accessory.Now I rewrote the code example in C using the characteristics of a motion detector instead of a switch.

Furthermore I want to use the MFRC522.c library, link. Including it with #include "MFRC522.h" obviously returns me the following error while compiling:

require_cpp11.h:9:2: error: #error "This library needs at least a C++11 compliant compiler, maybe compiler argument for C++11 support is missing or if you use Arduino IDE upgrade to version >=1.6.6"

Anyone knows of a MFRC522 library coded in C? Or tips of how to include a C++ library into C code? I read about the "extern C"-solution for the header file what didnt work either for me.

extern "C" {} is for using C code in C++, not for using C++ code in C.

Just rename all your .c files to .cpp files so they get compiled with the C++ compiler. There are very few cases where C code can't compile as C++ code and those are easy to fix.

Arduino sketches are compiled as C++.

Thank you. I renamed every file ending to .c to .cpp, but since the HomeKit code I linked above is based on esp_open_sdk and esp-open-rtos it throws me a lot of errors. I was renaming 280 files and the compiling of the whole code in C++ ended in:

AS /Volumes/cs/cpp/esp-open-rtos/open_esplibs/libmain/xtensa_context.S
C++ /Volumes/cs/cpp/esp-open-rtos/open_esplibs/libmain/ets_timer.cpp
C++ /Volumes/cs/cpp/esp-open-rtos/open_esplibs/libmain/misc.cpp
/Volumes/cs/cpp/esp-open-rtos/open_esplibs/libmain/misc.cpp:28:6: error: 'void sdk_ets_update_cpu_frequency(int)' aliased to undefined symbol 'sdk_os_update_cpu_frequency'
 void sdk_ets_update_cpu_frequency(int freq) __attribute__ (( alias ("sdk_os_update_cpu_frequency") ));
      ^
make: *** [build/open_esplibs_libmain//misc.o] Error 1
C++ /Volumes/cs/cpp/esp-open-rtos/open_esplibs/libmain/misc.cpp
/Volumes/cs/cpp/esp-open-rtos/open_esplibs/libmain/misc.cpp:28:6: error: 'void sdk_ets_update_cpu_frequency(int)' aliased to undefined symbol 'sdk_os_update_cpu_frequency'
 void sdk_ets_update_cpu_frequency(int freq) __attribute__ (( alias ("sdk_os_update_cpu_frequency") ));
      ^
make: *** [build/open_esplibs_libmain//misc.o] Error 1
Janicks-iMac:esp-homekit-demo janick$

I would try commenting out line 28 of misc.cpp. If the alias is never used, then you're done. If you get an error because the alias is not declared, use the original name instead.

Really, if you are using an ESP Open RTOS you should probably be asking questions of the ESP Open RTOS folks, not the Arduino folks. Have you tried converting the library you want to use into C code? If you are using an RTOS you may need to rewrite the Arduino code anyway.