Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > boost::regex - fail to compile a simple sample

Reply
Thread Tools

boost::regex - fail to compile a simple sample

 
 
FBergemann@web.de
Guest
Posts: n/a
 
      11-03-2006
I use SunOS 5.8, gcc 3.3.2, boost 1.33.1.
I have build the entire boost package and try to compile a simple
example:

#include <iostream>
#include <string>
#include <boost/regex.hpp> // Boost.Regex lib

using namespace std;

int main( ) {

std::string s, sre;
boost::regex re;

while(true)
{
cout << "Expression: ";
cin >> sre;
if (sre == "quit")
{
break;
}
cout << "String: ";
cin >> s;

// Set up the regular expression for case-insensitivity
re.assign(sre, boost::regex_constants::icase);
if (boost::regex_match(s, re))
{
cout << re << " matches " << s << endl;
}
}
}

try to compile it this way [path for include files and static libs are
ok]:

> g++ -o test test.cc -I$ROOT/include/ -L$ROOT/lib -lboost_regex-gcc



But i get:

Undefined first referenced
symbol in file
boost::re_detail::c_traits_base::class_map /var/tmp//ccBM7Erf.o
boost::re_detail::c_traits_base::lower_case_map
/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char>
>::reg_expression[not-in-charge](std::allocator<char> const&)/var/tmp//ccBM7Erf.o

boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::size() const/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::empty() const/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::~reg_expression
[not-in-charge]()/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::first(boost::reg_expression<char,
boost::regex_traits<char>, std::allocator<char> >
const&)/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::mark_count() const/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::can_start(char, unsigned char const*, unsigned
char, boost::re_detail::_narrow_type const&)/var/tmp//ccBM7Erf.o
boost::c_regex_traits<char>::transform_primary(std ::basic_string<char,
std::char_traits<char>, std::allocator<char> >&,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&)/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::set_expression(char const*, char const*,
unsigned)/var/tmp//ccBM7Erf.o
boost::re_detail::raise_regex_exception(std::basic _string<char,
std::char_traits<char>, std::allocator<char> >
const&)/var/tmp//ccBM7Erf.o
boost::c_regex_traits<char>::transform(std::basic_ string<char,
std::char_traits<char>, std::allocator<char> >&,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&)/var/tmp//ccBM7Erf.o
boost::re_detail::c_traits_base::error_string(unsi gned)/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::get_traits() const/var/tmp//ccBM7Erf.o
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::str() const/var/tmp//ccBM7Erf.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status


Can anybody help me?
I already looked around the web, but didn't find a clue.

Regards!

Frank

 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      11-03-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I use SunOS 5.8, gcc 3.3.2, boost 1.33.1.
> I have build the entire boost package and try to compile a simple
> example:
>
> #include <iostream>
> #include <string>
> #include <boost/regex.hpp> // Boost.Regex lib
>
> using namespace std;
>
> int main( ) {
>
> std::string s, sre;
> boost::regex re;
>
> while(true)
> {
> cout << "Expression: ";
> cin >> sre;
> if (sre == "quit")
> {
> break;
> }
> cout << "String: ";
> cin >> s;
>
> // Set up the regular expression for case-insensitivity
> re.assign(sre, boost::regex_constants::icase);
> if (boost::regex_match(s, re))
> {
> cout << re << " matches " << s << endl;
> }
> }
> }
>
> try to compile it this way [path for include files and static libs are
> ok]:
>
> > g++ -o test test.cc -I$ROOT/include/ -L$ROOT/lib -lboost_regex-gcc

>
>
> But i get:
>
> Undefined first referenced
> symbol in file
> boost::re_detail::c_traits_base::class_map /var/tmp//ccBM7Erf.o
> boost::re_detail::c_traits_base::lower_case_map
> /var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char>
> >::reg_expression[not-in-charge](std::allocator<char> const&)/var/tmp//ccBM7Erf.o

> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::size() const/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::empty() const/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::~reg_expression
> [not-in-charge]()/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::first(boost::reg_expression<char,
> boost::regex_traits<char>, std::allocator<char> >
> const&)/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::mark_count() const/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::can_start(char, unsigned char const*, unsigned
> char, boost::re_detail::_narrow_type const&)/var/tmp//ccBM7Erf.o
> boost::c_regex_traits<char>::transform_primary(std ::basic_string<char,
> std::char_traits<char>, std::allocator<char> >&,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> const&)/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::set_expression(char const*, char const*,
> unsigned)/var/tmp//ccBM7Erf.o
> boost::re_detail::raise_regex_exception(std::basic _string<char,
> std::char_traits<char>, std::allocator<char> >
> const&)/var/tmp//ccBM7Erf.o
> boost::c_regex_traits<char>::transform(std::basic_ string<char,
> std::char_traits<char>, std::allocator<char> >&,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> const&)/var/tmp//ccBM7Erf.o
> boost::re_detail::c_traits_base::error_string(unsi gned)/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::get_traits() const/var/tmp//ccBM7Erf.o
> boost::reg_expression<char, boost::regex_traits<char>,
> std::allocator<char> >::str() const/var/tmp//ccBM7Erf.o
> ld: fatal: Symbol referencing errors. No output written to test
> collect2: ld returned 1 exit status
>
>
> Can anybody help me?
> I already looked around the web, but didn't find a clue.
>
> Regards!
>
> Frank


While you could certainly ask about how to use Boost.Regex here
(because it is part of TR1), linker problems like this are really more
of platform issue and should be addressed either on the Boost user list
(http://boost.org/more/mailing_lists.htm#users) or on a group dedicated
to your platform.

Cheers! --M

 
Reply With Quote
 
 
 
 
bestinbestin@yahoo.com
Guest
Posts: n/a
 
      12-06-2006

"mlimber 写道:
"
my question is :


ompiling...
Cpp1.cpp
warning: STLPort debug versions are built with /D_STLP_DEBUG=1
c:\c++\boost_1_33_1\boost\config\auto_link.hpp(211 ) : fatal error
C1189: #error : "Build options aren't compatible with pre-built
libraries"
Error executing cl.exe.

Cpp1.exe - 1 error(s), 1 warning(s)

help me!

 
Reply With Quote
 
bestinbestin@yahoo.com
Guest
Posts: n/a
 
      12-06-2006
I'AM chinese .so i speak chinese.
please use chinese-english translate software.
if you don't understand what i said.I so sorry.
兄弟,你的代码我在WINDOW
平台上面是可以编译通过的。

对了要想使用REGEX,你的机器里必须有
mine is
libboost_regex-vc6-sgd-1_33_1.lib
yours is
libboost_regex-sunpro-sgd-1_33_1.lib


我的就是因为没有这个。所以编译不过去

your code could compile in windows in vc6
look up your lib,and find the "libboost_regex-vc6-sgd-1_33_1.lib"
if not exists,you could compile the file
"libboost_regex-vc6-sgd-1_33_1.lib"


boost\libs\regex\build\
then nmake(in windows is like this,but in sun ,I don't know) the
sunpro.mak

in default ,the libboost_regex-sunpro-sgd-1_33_1.lib isn't compiled
 
Reply With Quote
 
bestinbestin@yahoo.com
Guest
Posts: n/a
 
      12-06-2006
I'am so sorry!!


> mine is
> libboost_regex-vc6-sgd-1_33_1.lib
> yours is
> libboost_regex-sunpro-sgd-1_33_1.lib
>


 
Reply With Quote
 
bestinbestin@yahoo.com
Guest
Posts: n/a
 
      12-06-2006
I'am so sorry!!


> mine is
> libboost_regex-vc6-sgd-1_33_1.lib
> yours is
> libboost_regex-sunpro-sgd-1_33_1.lib
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
looking for asp.net sample with vb.net backend sample is there one? Jake ASP .Net 0 02-09-2006 10:44 PM
Templates: Why does this fail to compile? A Moore C++ 10 03-25-2005 04:27 PM
Using "const" : why does compile fail Jim West C++ 5 10-13-2003 11:52 PM
if (f() != FAIL) or if (FAIL != f())? Wenjie C Programming 3 07-31-2003 09:54 PM



Advertisments