By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

boost::regex - fail to compile a simple sample

P: n/a
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<charconst&)/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<c har,
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

Nov 3 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
FB********@web.de 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<charconst&)/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<c har,
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

Nov 3 '06 #2

P: n/a

"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!

Dec 6 '06 #3

P: n/a
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
Dec 6 '06 #4

P: n/a
I'am so sorry!!

mine is
libboost_regex-vc6-sgd-1_33_1.lib
yours is
libboost_regex-sunpro-sgd-1_33_1.lib
Dec 6 '06 #5

P: n/a
I'am so sorry!!

mine is
libboost_regex-vc6-sgd-1_33_1.lib
yours is
libboost_regex-sunpro-sgd-1_33_1.lib
Dec 6 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.