www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - try importC on macOS, get this error

reply d007 <d007 gmail.com> writes:
try with lastest ldc:

```sh
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(137): Error: found `_close` when expecting `)`
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(137): Error: `;` or `,` expected
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(138): Error: found `_read` when expecting `)`
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(138): Error: `;` or `,` expected
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(139): Error: found `_seek` when expecting `)`
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(139): Error: `;` or `,` expected
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(140): Error: found `_write` when expecting `)`
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/in
lude/_stdio.h(140): Error: `;` or `,` expected
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(153): Error: missing comma or semicolon after declaration of
`fopen`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(157): Error: missing comma or semicolon after declaration of
`fputs`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(160): Error: missing comma or semicolon after declaration of
`freopen`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(165): Error: missing comma or semicolon after declaration of
`fwrite`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(227): Error: missing comma or semicolon after declaration of
`fdopen`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(244): Error: missing comma or semicolon after declaration of
`popen`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/i
clude/stdio.h(314): Error: missing comma or semicolon after declaration of
`tempnam`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
ys/resource.h(567): Error: missing comma or semicolon after declaration of
`getrlimit`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
ys/resource.h(573): Error: missing comma or semicolon after declaration of
`setrlimit`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/incl
de/sys/wait.h(248): Error: missing comma or semicolon after declaration of
`wait`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/incl
de/sys/wait.h(249): Error: missing comma or semicolon after declaration of
`waitpid`, found `__asm` instead
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/incl
de/sys/wait.h(251): Error: missing comma or semicolon after declaration of
`waitid`, found `__asm` instead
```
Mar 15 2023
next sibling parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
A few potential bug reports:

https://issues.dlang.org/show_bug.cgi?id=22161
https://issues.dlang.org/show_bug.cgi?id=23725
https://issues.dlang.org/show_bug.cgi?id=22722

It may also be required if we want out of the box support on Windows, as 
the mingw headers also use inline assembly (which errors out).
Mar 15 2023
parent d007 <d007 gmail.com> writes:
On Thursday, 16 March 2023 at 06:05:53 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 A few potential bug reports:

 https://issues.dlang.org/show_bug.cgi?id=22161
 https://issues.dlang.org/show_bug.cgi?id=23725
 https://issues.dlang.org/show_bug.cgi?id=22722

 It may also be required if we want out of the box support on 
 Windows, as the mingw headers also use inline assembly (which 
 errors out).
this seems like silly bug. (after clang -E) ```sh /src/pcache.h(25): Error: struct `test.PgHdr` conflicts with alias `test.PgHdr` at /pcache.h(18) ``` ```c typedef struct PgHdr PgHdr; struct PgHdr { // body } ```
Mar 16 2023
prev sibling parent reply Dave P. <dave287091 gmail.com> writes:
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`.
Mar 15 2023
parent d007 <d007 gmail.com> writes:
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 `,` ```
Mar 16 2023