Cannot compile betterC app in windows using stderr
Basile B.
b2.temp at gmx.com
Wed Feb 2 07:33:58 UTC 2022
On Wednesday, 2 February 2022 at 01:24:30 UTC, Abby wrote:
> I have a simple
>
>
> **dub.sdl**
> ```
> name "test"
> targetType "executable"
> buildOptions "betterC"
> ```
>
> **app.d**
> ```
> module test;
> import core.stdc.stdio : fprintf, stderr;
>
> extern(C) int main(string[] args)
> {
> fprintf(stderr, "Test\n",);
> return 0;
> }
> ```
>
>
>
> When I'm trying to compile this on windows with latest dmd or
> ldc I get
> ```Performing "debug" build using
> C:\D\dmd2\windows\bin64\dmd.exe for x86_64.
> test ~master: building configuration "application"...
> Linking...
> test.obj : error LNK2019: unresolved external symbol stderr
> referenced in function main
> .dub\build\application-debug-windows-x86_64-dmd_v2.098.1-dirty-FB5231E74956BBA34BF960F450A8342C\test.exe : fatal error LNK1120: 1 unresolved externals
> Error: linker exited with status 1120
> C:\D\dmd2\windows\bin64\dmd.exe failed with exit code 1.
> ```
>
>
> Works with dmd-2.091.0
>
> Any idea what might be the problem here?
Yes, I have an idea, although not a Windows user. So look at the
definitions i `core.stdc.stdio`:
```d
else version (CRuntime_Microsoft)
{
///
shared FILE* stdin; // = &__iob_func()[0];
///
shared FILE* stdout; // = &__iob_func()[1];
///
shared FILE* stderr; // = &__iob_func()[2];
}
```
shouldn't these variable declarations be `extern` ?
More information about the Digitalmars-d
mailing list