Error: undefined symbol: _WinMain at 16 When try compile no console

frame frame86 at live.com
Thu May 26 18:17:32 UTC 2022


On Thursday, 26 May 2022 at 16:56:49 UTC, Marcone wrote:
> On Friday, 20 May 2022 at 13:16:00 UTC, frame wrote:
>> On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote:

> I tried compiling now on x64 without console using 
> -L/SUBSYSTEM:windows user32.lib -L/entry:mainCRTStartup -m64 
> and it doesn't work. It compiles, but the program does not run 
> afterwards. I also tried to add -m32omf But in this case the 
> compilation error. How to solve this?

There is no support for OMF for x64, 64bit build is always 
MS-COFF.

If you specify -m64 you will generate x64 MS-COFF files.
If you specify -m32mscoff you will generate x86 32bit MS-COFF 
files.
If you specify -m32omf you will generate x86 32bit OMF files.

Maybe you need to clear your object files (if any) for a clean 
build.

If you tell the linker to entry on `mainCRTStartup`, it is 
expected to use that function from a C-runtime linked. As the 
compiler is free to select a library, this is the possible error 
source. Try different options for `-mscrtlib=libname` switch.

What do you mean by not running? Does it return an error code? 
(please start it in some debugger)


More information about the Digitalmars-d-learn mailing list