Undefined reference to WinMain (C++ Mingw)

后端 未结 3 530
梦如初夏
梦如初夏 2021-01-06 05:10

currently I am trying to make a windows application using c++. For compiling my program I use Mingw GCC. Btw I\'m on Windows 10. But as soon as I use int WINAPI wWinMa

3条回答
  •  不思量自难忘°
    2021-01-06 05:27

    The solution is to add -municode to the compilation parameters, as mentioned by @ssbssa in a comment.

    Example:

    g++ helloworld3.cpp -o helloworld3 -Wl,-subsystem,windows -municode
    

    See https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/

    While it is not necessary to define _UNICODE or UNICODE to compile the above code, -municode is needed for linking because it uses wmain() instead of the traditional main().

提交回复
热议问题