|
Boost Users : |
Subject: Re: [Boost-users] Installed boost::regex, and it compiles, but can't get it to link
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-15 01:41:28
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 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