digitalmars.D.learn - importC error: _Builtin_stddef
- Dakota (19/19) Aug 29 get this error:
- Lance Bachmeier (21/42) Aug 30 It's hard to say further without having the code you're
- Tim (6/27) Aug 30 As a workaround you could try to add something like this before
get this error: ```sh In file included from /llvm/lib/clang/18/include/stddef.h:77, from /usr/include/time.h:29, from /llvm/include/clang-c/CXFile.h:17, from /llvm/include/clang-c/CXSourceLocation.h:17, from /llvm/include/clang-c/CXDiagnostic.h:17, from /llvm/include/clang-c/Index.h:20, from /opt/d/D/c2d/src/c2di.c:1: /llvm/lib/clang/18/include/__stddef_size_t.h:15:50: error: missing binary operator before token "(" 15 | (__has_feature(modules) && !__building_module(_Builtin_stddef)) | ^ In file included from /llvm/lib/clang/18/include/stddef.h:92: /llvm/lib/clang/18/include/__stddef_null.h:10:41: error: missing binary operator before token "(" 10 | #if !defined(NULL) || !__building_module(_Builtin_stddef) ```
Aug 29
On Friday, 30 August 2024 at 04:49:48 UTC, Dakota wrote:get this error: ```sh In file included from /llvm/lib/clang/18/include/stddef.h:77, from /usr/include/time.h:29, from /llvm/include/clang-c/CXFile.h:17, from /llvm/include/clang-c/CXSourceLocation.h:17, from /llvm/include/clang-c/CXDiagnostic.h:17, from /llvm/include/clang-c/Index.h:20, from /opt/d/D/c2d/src/c2di.c:1: /llvm/lib/clang/18/include/__stddef_size_t.h:15:50: error: missing binary operator before token "(" 15 | (__has_feature(modules) && !__building_module(_Builtin_stddef)) | ^ In file included from /llvm/lib/clang/18/include/stddef.h:92: /llvm/lib/clang/18/include/__stddef_null.h:10:41: error: missing binary operator before token "(" 10 | #if !defined(NULL) || !__building_module(_Builtin_stddef) ```It's hard to say further without having the code you're compiling, but my best guess is that the C preprocessor is stuck on this or similar: https://clang.llvm.org/doxygen/____stddef__size__t_8h_source.html ``` /* * When -fbuiltin-headers-in-system-modules is set this is a non-modular header * and needs to behave as if it was textual. */ #if !defined(_SIZE_T) || \ (__has_feature(modules) && !__building_module(_Builtin_stddef)) #define _SIZE_T ``` Without more information I can't give any specific advice, but the answer may be to pass something to the preprocessor using -P in your compilation command as described here: https://dlang.org/spec/importc.html#auto-cpp
Aug 30
On Friday, 30 August 2024 at 04:49:48 UTC, Dakota wrote:get this error: ```sh In file included from /llvm/lib/clang/18/include/stddef.h:77, from /usr/include/time.h:29, from /llvm/include/clang-c/CXFile.h:17, from /llvm/include/clang-c/CXSourceLocation.h:17, from /llvm/include/clang-c/CXDiagnostic.h:17, from /llvm/include/clang-c/Index.h:20, from /opt/d/D/c2d/src/c2di.c:1: /llvm/lib/clang/18/include/__stddef_size_t.h:15:50: error: missing binary operator before token "(" 15 | (__has_feature(modules) && !__building_module(_Builtin_stddef)) | ^ In file included from /llvm/lib/clang/18/include/stddef.h:92: /llvm/lib/clang/18/include/__stddef_null.h:10:41: error: missing binary operator before token "(" 10 | #if !defined(NULL) || !__building_module(_Builtin_stddef) ```As a workaround you could try to add something like this before any includes: ``` #define __building_module(name) 0 ```
Aug 30