If you are new to wxWidgets then head over to

http://wxdsgn.sourceforge.net/

download the IDE with visual designer( its free) , everything is setup ready to go , try the same code in this IDE , it take care of all header and linker issues for you , codeblocks is a Good IDE , however more meat for exprienced developers ,

further http://www.3dbuzz.com have some great tutorials on wxWidgets and C++