Closed ilanbiala closed 1 year ago
Are you compiling C source files by C compiler? C and C++ are not compatible and C++ compiler can't compile C code. There are constructions which are allowed in C but prohibited in C++.
Problem is not the NULL itself, but that char * x = NULL
is allowed in C++, but char * x = a ? NULL : NULL
is not. This was allowed by the C++ standard but changed later and GCC6+ force this.
Feel free to provide PR which solve this.
When I try to compile this library in a C++ project, I get this error:
I checked which macros are set, and
SCPIDEFINE_strndup()
is defined from https://github.com/j123b567/scpi-parser/blob/a765b9eadd3fe29de5f8d426549b69fc0a96793c/libscpi/inc/scpi/config.h#L233 for me. This causes a problem when compiling in C++ sinceNULL
is interpreted as a long int, which cannot be implicitly converted to achar*
.