ImportC in a Dub project

mw mingwu at gmail.com
Fri Jun 21 22:38:14 UTC 2024


On Friday, 28 October 2022 at 19:08:47 UTC, Steven Schveighoffer 
wrote:
> On 10/28/22 2:43 PM, Carsten Schlote wrote:
>> On Friday, 28 October 2022 at 18:31:25 UTC, Steven 
>> Schveighoffer wrote:
>> 
>>> Are you passing the c file to the compiler? Also, you must be
...
> By default dub does not build C files (as evidenced by your 
> command line). It may not even let you I don't know, but try:
>
> ```json
>   "sourceFiles" : ["source/zstdc_binding.c"]
> ```

What if the dub.json target is a staticLibrary?

Right now I have this error:

```
gdc: fatal error: cannot specify ‘-o’ with ‘-c’, ‘-S’ or ‘-E’ 
with multiple files
```

Since both (a single) .d file and the single line .c (include 
".h") file is on the command line:

e.g.

```
gdc -dip25 -Wno-error=builtin-declaration-mismatch 
-fall-instantiations -c -o 
/.dub/cache/liblfdsd/0.3.4/build/library-unittest-swOTDhNpx8l9YtK1BPSAow/liblfdsd.a -fdebug -g -Werror -Wall -Wno-deprecated /.dub/packages/liblfdsd/0.3.4/liblfdsd/source/liblfdsd.d /.dub/packages/liblfdsd/0.3.4/liblfdsd/source/liblfdsd_ImportC.c -Xlinker -Xlinker -llfdsd -Xlinker -llfdsdc -Xlinker -llfds711

```

Thanks.


More information about the Digitalmars-d-learn mailing list