0

When I compile my program it doesn't compile, it just gives me a lot (and I mean really a lot) of text and errors. What is wrong with this?

const boost::regex expr("[A-Za-z_]+ +'='+ [0-9]+");

Sample errors:

C:\Users\Hunix\AppData\Local\Temp\ccKDhlNb.o:kat.cpp:(.text$_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE[boost::re_detail::cpp_regex_trait_char_layer<char>::cpp_regex_traits_char_layer(boost::re_d etail::cpp_regex_traits_base<char> const&)]+0x55): undefined reference to boost ::re_detail::cpp_regex_traits_char_layer<char>::init()'

C:\Users\Hunix\AppData\Local\Temp\ccKDhlNb.o:kat.cpp:(.text$_ZN5boost9re_detail11raw_storage6extendEj[boost::re_detail::raw_storage::extend(unsigned int)]+0x40) : undefined reference to boost::re_detail::raw_storage::

Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
hunix
  • 11
  • 5
  • I did what you said @Niall, but it's not better. :( It's only good if I leave the expr() without parameters. – hunix Nov 04 '14 at 19:55
  • Try using https://www.debuggex.com/ – Gillespie Nov 04 '14 at 20:01
  • @hunix: Please edit your question to add the error messages. – Fred Larson Nov 04 '14 at 20:12
  • 1
    It appears you have a link error, not a compile error. You have to add the Boost regex library to your libraries list. – Fred Larson Nov 04 '14 at 20:14
  • 1
    @Niall AFAIK you don't need to escape single quote inside double quotes. –  Nov 04 '14 at 20:16
  • @Arkadiy. This appears to be correct... – Niall Nov 04 '14 at 20:18
  • Your regex works ok using `boost::regex`, its a little strange so the problem lies with linking the libraries. I tested with [RegexFormat](http://www.regexformat.com), which contains embedded boost regex engine to test regex with. That portion of the program is free, to format you need a key. –  Nov 04 '14 at 21:11
  • @sln so how can I fix it? – hunix Nov 05 '14 at 18:31

0 Answers0