Boost logo

Boost Users :

Subject: Re: [Boost-users] Installed boost::regex, and it compiles, but can't get it to link
From: Jerry Davis (jdawgaz_at_[hidden])
Date: 2009-08-15 02:03:40


On Fri, 14 Aug 2009 22:41:28 -0700
Steven Watanabe <watanabesj_at_[hidden]> wrote:

> AMDG
>
> Jerry Davis wrote:
> > I am running ubuntu 9.04
> >
> > I have built the libs from 1.39.0 with gcc 4.3
> > and moved them to /usr/local/boost
> >
> > I have done a $ sudo ldconfig -v and have seen the boost libaries are
> > installed
> >
> > here is the code, taken from the boost web site:
> >
> > #include <boost/regex.hpp>
> > #include <iostream>
> > #include <string>
> >
> > using namespace std;
> >
> > int main()
> > {
> > string line;
> > boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
> >
> > while (cin)
> > {
> > getline(cin, line);
> > boost::smatch matches;
> > if (boost::regex_match(line, matches, pat))
> > cout << matches[2] << endl;
> > }
> > }
> >
> >
> > I can compile ok: g++ -I /usr/local/boost/include/boost-1_39 -c
> > regex_example.cpp
> >
> > But when I try to link I get a ton of errors, can anyone tell me what I need
> > to do next? -- Jerry
> >
> > $ g++ -I /usr/local/boost/include/boost-1_39
> > -L /usr/local/boost/lib regex_example.cpp
> >
>
> You need to link to the regex library with -lboost_regex.
> (or -lwhatever_the_boost_regex_library_is_named)
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

great. now i understand a lot better what the -l is for.

-- 
Hobbit Name: Pimpernel Loamsdown
Registered Linux User: 275424
K7AZJ
 
This email's Fortune: 
Drinking is not a spectator sport.
		-- Jim Brosnan

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