ldc-mingw - Windows sample - undefined reference to `_Dmain'

David Nadlinger code at klickverbot.at
Mon Oct 14 18:13:01 PDT 2013


On 14 Oct 2013, at 15:32, dnewbie wrote:
> Error 'undefined reference to `_Dmain'' when compiling 
> samples\d\winsamp.d.
>
> Workaround:
> a) add main() that calls myWinMain
> b) run objcopy for setting subsystem=windows and to get rid of the 
> 'DOS window':
> objcopy --subsystem windows:5.00 winsamp.exe winsamp2.exe
>
> Example:
> http://dpaste.dzfl.pl/8698696f

Thanks for going through the trouble to figure this one out.

We should probably handle WinMain like DMD does in the long run to make 
it easier for people to write bare Win32 application. But until that's 
done, it would be great if you could put the above information in some 
place where  that others can find it, e.g. the wiki.

Regarding the windows subsystem, I believe there is a flag for the MinGW 
linker (-mwindows? -Wl,subsystem,windows?). You could try just 
specifying it on the LDC command line using -L, it should save you the 
extra step.

David


More information about the digitalmars-d-ldc mailing list