Cannot compile betterC app in windows using stderr

duser duser at neet.fi
Wed Feb 2 09:27:02 UTC 2022


On Wednesday, 2 February 2022 at 07:51:07 UTC, Basile B. wrote:
> On Wednesday, 2 February 2022 at 07:33:58 UTC, Basile B. wrote:
>> On Wednesday, 2 February 2022 at 01:24:30 UTC, Abby wrote:
>>> I have a simple
>>>
>>>
>>> **dub.sdl**
>>> ```
>>> name "test"
>>> targetType "executable"
>>> buildOptions "betterC"
>>> ```
>> shouldn't these variable declarations be `extern` ?
>
> Try
>
>
> ```d
> module test;
> import core.stdc.stdio : FILE, fprintf;
>
> extern shared FILE* stderr;
>
> extern(C) int main(string[] args)
> {
> 	fprintf(stderr, "Test\n",);
> 	return 0;
> }
> ```
>
> to confirm if it is or not the extern problem

missing `extern(C)`, it should be:

```D
module test;
import core.stdc.stdio : FILE, fprintf;

extern(C) extern shared FILE* stderr;

extern(C) int main(string[] args)
{
	fprintf(stderr, "Test\n",);
	return 0;
}
```


More information about the Digitalmars-d mailing list