Boost logo

Boost Users :

Subject: Re: [Boost-users] cann't compile Regular Expressions to Split a String code
From: Anthony Foiani (tkil_at_[hidden])
Date: 2011-07-11 01:03:23


Eric Lin <kingdavid1_at_[hidden]> writes:

>  I copied a piece simple Using Regular Expressions

Programs using Boost.Regex must be linked against the relevant
library. That is, Boost.Regex is *not* header-only.

On my system (Linux, Fedora 15 x86-64), I get link errors if I don't
specify the correct library:

  $ g++ -o regex-iterator regex-iterator.cpp
  [pages and pages of "undefined reference" errors]

But when I do specify the appropriate library, it works fine:

  $ g++ -o regex-iterator regex-iterator.cpp -lboost_regex

  $ ./regex-iterator
  who
  lives
  in
  a
  pineapple
  under
  the
  sea?

In general, any time you see an "undefined reference", that's a hint
that you don't have all the necessary libraries on your link line.
(Or that you're trying to use an entity that has a valid signature but
is lacking an implementation; e.g., a template declaration that does
not have a matching definition / instantiation.)

Hope this helps!

Regards,
Tony


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net