Friday, January 8, 2016

Getting Code::Blocks to work with regex in Windows

The current stable release of Code::Blocks 13.12 comes with GCC v4.7.1, which does not implement regex. Regex was implemented and released in GCC 4.9.0

1. Download tdm-gcc from http://tdm-gcc.tdragon.net/
2. After installing, open Code::Blocks. Go to Settings -> Compiler -> Toolchain executables
3. Change the Compiler's installation directory to where tdm-gcc was installed. (Default is C:\TDM-GCC-64)
4. Direct the C compiler to gcc.exe, C++ compiler to g++.exe, and linker for dynamic libs to g++.exe. These are all found in the 'bin' folder, i.e. C:\TDM-GCC-64\bin
5. Make sure in the compiler settings, 'Have g++ follow the C++11 ISO C++ language standard' is checked

Sources:
http://stackoverflow.com/questions/8060025/is-this-c11-regex-error-me-or-the-compiler
http://stackoverflow.com/questions/12808650/how-can-i-change-the-compiler-in-codeblocks

No comments:

Post a Comment