nihui / waifu2x-ncnn-vulkan

waifu2x converter ncnn version, runs fast on intel / amd / nvidia / apple-silicon GPU with vulkan
MIT License
2.98k stars 205 forks source link

fix MinGW compilation #195

Open hch12907 opened 1 year ago

hch12907 commented 1 year ago

Without the change, I can see the following error report:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\waifu2x-ncnn-vulkan.dir\build.make:133: waifu2x-ncnn-vulkan.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:311: CMakeFiles/waifu2x-ncnn-vulkan.dir/all] Error 2
mingw32-make: *** [Makefile:148: all] Error 2

As far as I understand it, the problem is that MinGW expects main()/WinMain() without -municode, but the code uses wmain()/wWinMain().