try importC on macOS, get this error

Dave P. dave287091 at gmail.com
Thu Mar 16 06:30:51 UTC 2023


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`.



More information about the Digitalmars-d mailing list