I used -mwindows in the GCC C++ Compiler - misc flag section. Same errors occurred.
Bringing -mwindows down to the linker in: Project | Properties | MinGW C++ Linker | Miscellaneous | Linker Flags field... fixed the problem. The program compiled and ran fine.
>>Re: [Mingw-users] wingdi.h and w32API GetCurrentObject>> From: Earnie Boyd <earnie@......> - 2012-06-12 15:24
>>On Tue, Jun 12, 2012 at 8:31 AM, Vincent Torri <vincent.torri@...> wrote:
>>> according to that thread:
> http://gcc.gnu.org/ml/gcc-help/2004-01/msg00225.html > Ian was somewhat wrong in using "compiler" term in his explanation but
it is an understandable term since GCC is GNU C Compiler. He adds
that it is used during the link phase. > -mwindows is a compiler flag, even if it adds libs to the linker libs list -mwindows is a GCC front end option to supply the linker with the
correct set of flags. The linker itself however does not understand
-mwindows. The truth is in -dumpspecs and -mwindows does more than
add libraries. --