Is "Enable c++14" (or "Enable c++1y") checked in the compiler settings?
Make sure to use an SFML and TGUI version that match each other and the compiler. SFML 2.5 only provides a build for GCC 5.1, similar to the TGUI 0.8 alpha version. If you use GCC 4.9 (from codeblocks 16.04) then you not only have to use the SFML 2.4.2 package but also a TGUI version that was build with SFML 2.4.2 and GCC 4.9 (like the pre-alpha versions). If you can't find matching versions then you could always build SFML and TGUI yourself with whatever compiler you want to use.
I would suggest just getting CodeBlocks 17.12, SFML 2.5 and TGUI 0.8-alpha, all using TDM GCC 5.1 (SJLJ).