I just try build this example for GCC.
But I got several problems.
My system is:
- Win10
- msys64 with ucrt64 (x86_64-w64-mingw32)
c:\windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~19041.2486.1.5\amd64_microsoft-windows-netapi32_31bf3856ad364e35_10.0.19041.2130_none_0202483cb6bb2fc6\f\netapi32.dll
- Atom as IDE (I have not VS)
cmd
as console
I try: gcc main.c -o main.exe -lnetapi32
But gcc
returned:
undefined reference to `WinMain' collect2.exe: error: ld returned 1 exit status
OK - wrong entry point.
Changed wMain
in WinMain
.
Result:
main.c:11:5: error: conflicting types for 'WinMain'; have 'int(int, wchar_t **)' {aka 'int(int, short unsigned int **)'}
11 | int WinMain(int argc, wchar_t *argv[])
| ^~~~~~~
In file included from c:/msys64/ucrt64/include/windows.h:70,
from main.c:8:
c:/msys64/ucrt64/include/winbase.h:1128:14: note: previous declaration of 'WinMain' with type 'int(struct HINSTANCE__ *, struct HINSTANCE__ *, CHAR *, int)' {aka 'int(struct HINSTANCE__ *, struct HINSTANCE__ *, char *, int)'}
1128 | int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
What is wrong?