I downloaded the latest version of Code::Blocks and installed the compiler that came with the download, MinGW. I am having the same problem. "undefined reference to 'WinMain@16'. I went to the MinGW blog site and found a reference to requiring to turn on the "mwindows flag". I have attempted and was unable to find a "compiler flag" "mwindows" anywhere in the compiler settings provided through the installed Code::Blocks IDE.
I did find a readme file in the MinGW folder installed under Code::Blocks that had the following comment: "This edition of TDM-GCC is an unofficial replacement for the official GCC binaries distributed by the MinGW project; please note the following caveats: * TDM-GCC is not formally affiliated with or endorsed by the MinGW project. * No level of support for TDM-GCC is in any way guaranteed, although a best effort is made to fix bugs as they are found or forward them to GCC Bugzilla."
At this point I am at a loss. Since Code::Blocks provided an "unofficial" version of MinGW with the installation of the IDE, then it is somewhat an issue of the Code::Blocks IDE, not just a "compiler problem".
How do I fix this problem? Do I download the MinGW installer from SourceForge and attempt to install it under the Code::Blocks install? How do I re-integrate the newer install of MinGW compiler with the existing installation of Code::Blocks?
Let me add this comment: I am something of an experienced programmer from many years ago, attempting to re-learn C++ for a specific project that I want to do. The level of difficulty I am in finding a solution to this issue would likely be more than anyone starting out would overcome.