Boost logo

Boost Users :

From: Jin Sun (jinsun_at_[hidden])
Date: 2007-11-23 16:40:47


canx11 wrote:
> Hello,
>
> i am new to c++ coding and for practicing i want to rewrite some of my old
> perl scripts that use regular expressions in c++. So i installed libboost
> for regex version 1.34.1 on my workstation (using a kubuntu package).
>
> Unfortunatley even the most simple program i can think of does not want to
> compile:
>
> #include <iostream>
> #include <cstdlib>
> #include <boost/regex.hpp>
> using namespace boost;
> using namespace std;
>
> int main(int argc, char *argv[])
> {
> boost::regex(".*");
> cout << "test\n";
> return 0;
> }
>
> ...giving me:
>
> [...]
> testapp.o: In function `boost::basic_regex<char, boost::regex_traits<char,
> boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned
> int)':
> /usr/include/boost/regex/v4/basic_regex.hpp:255: undefined reference to
> `boost::basic_regex<char, boost::regex_traits<char,
> boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*,
> unsigned int)'
> collect2: ld returned 1 exit status
> [...]
>
> Anyhow if i am doing
>
> int main(int argc, char *argv[])
> {
> boost::regex();
> cout << "test\n";
> return 0;
> }
>
> withouth passing a regex condition it compiles successful...Yes i know this
> short programm does not give any meaningful functionality but i just want to
> demonstrate that the intialization of the basic_regex fails on my machine.
>
> Do i have problem with my libboost installation or just a simple syntax error
> here?
>
> regards
>
> Jan
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
link with -lboost_regex-gcc41-1_34_1

-- 
Jin Sun
MS-CS
Michigan Technological University
1400 Townsend Dr.
Houghton, MI-49931.
Phone #: (906) 370 2261(H)
          (906) 487 4305(O)
http://www.cs.mtu.edu/~jinsun

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