Open hmueller01 opened 6 years ago
Instead of changing the SDK headers, one could also add the extern "C"
while including C headers in cpp code.
e.g.
// put C includes inside here to avoid undefined references by linker.
extern "C" {
#include <ets_sys.h>
}
#define BOOL bool
#define TRUE true
#define FALSE false
still needs to be fixed (outside #ifndef __cplusplus
). E.g. the mqtt example won't compile with c++ otherwise.
I had some trouble to compile c++ code with the SDK. Firstly all prototypes in all header files (e.g.
ets_sys.h
,c_types.h
, ...) must be capsuled byextern "C"
:Otherwise linker fails with undefined reference.
Also
c_types.h
should be patched, becausebool
,true
andfalse
are defined in c++ (which was correctly excluded for c++), butBOOL
,TRUE
andFALSE
are not: