On Tuesday, 10 August 2021 at 19:03:06 UTC, Marcone wrote:
On Tuesday, 10 August 2021 at 19:01:42 UTC, Adam D Ruppe wrote:
On Tuesday, 10 August 2021 at 18:59:33 UTC, Marcone wrote:
Using -Lgdi32.lib -Luser32.lib? Same error.

The part after that:

If you want the Windows subsystem too, use -L/subsystem:windows -L/entry:mainCRTStartup.


Pass BOTH -L/subsystem:windows AND -L/entry:mainCRTStartup

Good! work very well! Thank you!

The difference is because DMD uses different linkers on Windows.

By default, it links 32-bit programs with OPTLINK. That linker only requires the subsystem flag---it will recognize that you have a `main` function.

When compiling with -m32mscoff or -m64, it uses the Microsoft linker. That linker requires that you also specify the program entry function---it always expects `WinMain`, and the `mainCRTStartup` tells it to look for `main` instead.

Reply via email to