try importC on macOS, get this error

d007 d007 at gmail.com
Thu Mar 16 07:45:40 UTC 2023


On Thursday, 16 March 2023 at 06:30:51 UTC, Dave P. wrote:
> On Thursday, 16 March 2023 at 05:52:21 UTC, d007 wrote:
>> try with lastest ldc:
>>
>> [...]
>
> ldc2 does not run the c-preprocessor yet. See the below for an 
> example of how you can currently do it:
>
>
> ```C
> // foo.c
> #include <stdio.h>
> int main(){
>     printf("hello\n");
>     return 0;
> }
> ```
> Included with your ldc install is an `importc.h` that you’ll 
> need to include to macro away some constructs D doesn’t 
> understand.
>
> You can then build as so:
> ```sh
> $ clang -E foo.c -o foo.i -include  
> $LDC_INSTALL/import/importc.h
> $ ldc2 foo.i
> $ ./foo
> ```
>
> Which prints `hello`.

Thanks for all tips.


I already use calng -E.


try linux also get error:

```sh
/usr/include/inttypes.h(297): Error: found `__nptr` when 
expecting `,`
/usr/include/inttypes.h(297): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(298): Error: found `__endptr` when 
expecting `,`
/usr/include/inttypes.h(298): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(301): Error: found `__nptr` when 
expecting `,`
/usr/include/inttypes.h(301): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(302): Error: found `__endptr` when 
expecting `,`
/usr/include/inttypes.h(302): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(305): Error: found `__nptr` when 
expecting `,`
/usr/include/inttypes.h(305): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(306): Error: found `__endptr` when 
expecting `,`
/usr/include/inttypes.h(306): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(310): Error: found `__nptr` when 
expecting `,`
/usr/include/inttypes.h(310): Error: no type-specifier for 
parameter
/usr/include/inttypes.h(311): Error: found `__endptr` when 
expecting `,`
/usr/include/inttypes.h(311): Error: no type-specifier for 
parameter
/usr/include/stdio.h(176): Error: missing comma or semicolon 
after declaration of `tmpfile`, found `__asm__` instead
/usr/include/stdio.h(257): Error: found `__filename` when 
expecting `,`
/usr/include/stdio.h(257): Error: no type-specifier for parameter
/usr/include/stdio.h(257): Error: found `__modes` when expecting 
`,`
```


More information about the Digitalmars-d mailing list