Thread overview | |||||
---|---|---|---|---|---|
|
October 14, 2013 ldc-mingw - Windows sample - undefined reference to `_Dmain' | ||||
---|---|---|---|---|
| ||||
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 |
October 15, 2013 Re: ldc-mingw - Windows sample - undefined reference to `_Dmain' | ||||
---|---|---|---|---|
| ||||
Posted in reply to dnewbie | 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
|
October 15, 2013 Re: ldc-mingw - Windows sample - undefined reference to `_Dmain' | ||||
---|---|---|---|---|
| ||||
On 15 Oct 2013, at 3:13, David Nadlinger wrote:
> -Wl,subsystem,windows
That should have been -Wl,--subsystem,windows, or for use with LDC, -L--subsystem -Lwindows.
It's been quite some while since I last messed around with those flags, and I never tried them with LDC so far.
David
|
Copyright © 1999-2021 by the D Language Foundation