Program exited with code 1

Mike Parker aldacron at gmail.com
Thu Apr 19 13:44:57 UTC 2018


On Thursday, 19 April 2018 at 11:21:52 UTC, Andrey wrote:
> On Thursday, 19 April 2018 at 08:37:19 UTC, Andrey wrote:
>> What will be a solution?
>
> It seems to me that I found a solution - just replace WinMain() 
> with main().

That's fine when you want a console app, but it leaves you with a 
console window automatically popping up if you create a windowed 
app.

When using WinMain, you have to manually setup and tear down 
DRuntime as described in the wiki[1]. Alternatively, you can get 
rid of the console window with a main function via linker flags 
-- when using OPTLINK (the default):

-L/SUBSYSTEM:windows

should be enough. With -m32mscoff or -m64, which uses the MS 
linker, you'll both that and this:

-L/ENTRY:mainCRTStartup

[1] https://wiki.dlang.org/D_for_Win32


More information about the Digitalmars-d-learn mailing list