注意在 Eclipse for c/c++ & MinWG 环境下
上述程序会出现如下问题:
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
undefined reference to `GetStockObject@4'
解决办法:
右击工程--property--c/c++ build -- setting ---MinGW C++ linker -- libraries --- add [gdi32.lib]
==================
以上解决办法: 思路来自
http://stackoverflow.com/questions/1351712/how-to-add-a-library-to-an-eclipse-project
right click to project -> Properties -> C/C++ Build, go to Library and add it there.