Building Win32 application via dub

Sam E. sam.e at example.org
Tue Apr 28 19:25:06 UTC 2020


Hi,

I'm fairly new to D, just playing around with Win32 bindings. I 
have a Win32 hello world that works when build via `dmd 
.\source\app test-win32.def`. I'm now trying to build the 
application via `dub`, but I cannot find what configuration I 
would need to do so.

By default, just running `dub`, I get the following error:

```
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for 
x86_64.
test-win32 ~master: building configuration "application"...
Linking...
test-win32.obj : error LNK2019: unresolved external symbol 
MessageBoxA referenced in function WinMain
.dub\build\application-debug-windows-x86_64-dmd_2091-347A0A76992D6DB80483AD860293313E\test-win32.exe : fatal error LNK1120: 1 unresolved externals
Error: linker exited with status 1120
C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.
```

The code is the one from https://wiki.dlang.org/D_for_Win32, with 
a simple extra `MessageBoxA` in the function `myWinMain`.

I'm a bit surprised to see a linking error given that building 
directly from `dmd` seems to work fine without any flag.

What am I missing?


More information about the Digitalmars-d-learn mailing list