help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Link problem about boost with g++


From: doudehou
Subject: Link problem about boost with g++
Date: 26 Feb 2006 06:31:12 -0800
User-agent: G2/0.2

First of all, I just made a mistake to post the message in
gun.gcc.help...
So I re-post it here. I think it will not off-topic now:-)


Below is a description about the problem:
Today, I downloaded the lastest version of boost. And compiled it with
my minGW(the version of g++ is 3.4.2). The compile command I used is
"bjam -sTOOLS=mingw --prefix=D:\3rd\boost install ". So all the
compiled .libs and the header files are placed in D:\3rd\boost. And I
set environment variant
CPLUS_INCLUDE_PATH=d:\3rd\boost\include\boost-1_34.

Then I wrote two short programs to test the new built boost.

The first was to test boost::shared_ptr, because shared_ptr refer no
.lib, so it passed the compilation.

The second is to test boost::regex. it need a link of some boost .lib.
But g++ report a link error when compiling.
I used "g++ rx.cpp -L D:\3rd\boost\lib -o rx" to generate the .exe.

The compile 's error message is:



E:\DOCUME~1\ddh\LOCALS~1\Temp/ccCebaaa.o(.text$_ZN5boost11regex_matchIN9__gnu_cx
x17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_
regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_E
ENS_15regex_constants12_match_flagsE[bool
boost::regex_match<__gnu_cxx::__normal
_iterator<char const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<ch
ar const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char>
> > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > 
> > > >>(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
boost::match_results<__gnu_cxx::__normal_iterator<char const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > > >&,
boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags)]+0x9a):rx.cpp: undefined
reference to
`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
const*, std::string>,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::string> > >,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()'
E:\DOCUME~1\ddh\LOCALS~1\Temp/ccCebaaa.o(.text$_ZN5boost11basic_regexIcNS_12rege
x_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j[boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> >
>::assign(char const*, char const*, unsigned int)]+0x22):rx.cpp: undefined 
>reference to `boost::basic_regex<char, boost::regex_traits<char, 
>boost::cpp_regex_traits<char> >>::do_assig

n(char const*, char const*, unsigned int)'
E:\DOCUME~1\ddh\LOCALS~1\Temp/ccCebaaa.o(.text$_ZN5boost9re_detail12perl_matcher
IN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsI
cNS_16cpp_regex_traitsIcEEEEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_11basic_r
egexIcSD_EENS_15regex_constants12_match_flagsES6_[boost::re_detail::perl_matcher
<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char,
boost::cpp_regex_traits<char> >
>::perl_matcher(__gnu_cxx::__normal_iterator<char const*, 
>std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>,
std::allocator<char> > >,
boost::match_results<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> > > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > >
const&,boost::regex_constants::_match_flags,
__gnu_cxx::__normal_iterator<char
const*,std::basic_string<char, std::char_traits<char>,
std::allocator<char> >>)]+0x110):rx.cpp: undefined reference to
`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
const*, std::string>,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::string> > >,boost::regex_traits<char,
boost::cpp_regex_traits<char>
>>::construct_init(boost::basic_regex<char, boost::regex_traits<char, 
>>boost::cpp_regex_traits<char> > > const&,boost::regex_const 
>>ants::_match_flags)'
collect2: ld returned 1 exit status




I think the problem is that g++ didn't know which .lib it should used
to generate the .exe file. But how to set it ? I don't want to add the
proper .lib name in the compile command everytimes.

Thank you very much for your help !



reply via email to

[Prev in Thread] Current Thread [Next in Thread]