OrangeC icon indicating copy to clipboard operation
OrangeC copied to clipboard

Error: Undefined External 'WinMain' in module c0pe.nas

Open ghost opened this issue 2 years ago • 4 comments
trafficstars

Very simple program:

#include <windows.h>

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               PWSTR szCmdLine, int CmdShow) {

    MessageBoxW(NULL, szCmdLine, L"Title", MB_OK);

    return 0;
}

Tried with both occ /Wg and gccocc -mwindows.

ghost avatar Oct 17 '23 17:10 ghost

hm i'll have to work on this do we need a wmain() too?

LADSoft avatar Oct 19 '23 00:10 LADSoft

Change the code to this and it will compile:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               LPSTR szCmdLine, int CmdShow) {

    MessageBoxW(NULL, szCmdLine, L"Title", MB_OK);

    return 0;
}

ghost avatar Nov 12 '23 09:11 ghost

According to https://learn.microsoft.com/windows/win32/learnwin32/winmain--the-application-entry-point the only thing to add is looking for either of both, preferably wWinain - not sure how to achieve this, though.

GitMensch avatar Feb 06 '24 07:02 GitMensch

we don't quite do linking the same way as microsoft... so... without a rewrite this isn't likely to happen without additional compiler switches. I may consider a rewrite later, not right now though....

LADSoft avatar Feb 09 '24 23:02 LADSoft