0

I want to use boost regex in c++ on code::blocks on windows. I compile a simple program which uses the instruction regex pat( "^Subject: (Re: |Aw: )*(.*)" ); and it doesn't work, I get errors like: c:\mingw\bin\..\lib\gcc\mingw32\4.5.2\..\..\..\..\include\boost\regex\v4\cpp_regex_traits.hpp|366|undefined reference to 'boost::re_detail::cpp_regex_traits_char_layer<char>::init()'|

I guess that I should link the project to some lib (.a file ?) in the "linker settings", but I don't know which lib, where can I download it ?!

shn
  • 5,116
  • 9
  • 34
  • 62

1 Answers1

1

You have to compile the regular expression library yourself. Please read the documentation http://www.boost.org/doc/libs/1_51_0/libs/regex/doc/html/boost_regex/install.html

Alan
  • 1,895
  • 1
  • 10
  • 9
  • There is no an already built boost regex library ? The doc show how to compile it for Visual C++, while I'm using g++/gcc with codeblocks ! – shn Oct 23 '12 at 12:59
  • On linux, there are usually pre-compiled boost libraries available as part of the distribution. On windows you'll probably have to compile it yourself. You should follow the GCC instructions http://www.boost.org/doc/libs/1_51_0/libs/regex/doc/html/boost_regex/install.html#boost_regex.install.gcc_2_95_and_later_ – Alan Oct 23 '12 at 13:10
  • More compilation info for windows here http://www.boost.org/doc/libs/1_51_0/more/getting_started/windows.html – Alan Oct 23 '12 at 13:13
  • This answer explains how to build Boost with Windows & MinGW, and where to find the libraries afterwards: http://stackoverflow.com/questions/13256788/building-boost-1-52-with-mingw/13257930#13257930 (don't forget to add MinGW's binaries directory to the Windows PATH environment variable beforehands) – Mathieu Rodic Aug 25 '13 at 09:11