|
Boost Users : |
From: Maik Beckmann (maikbeckmann_at_[hidden])
Date: 2006-09-08 13:41:05
Hello John
> Why not? Did you build regex against STLport?
It isn't that important to me to solve this isse, since at work (I'm a
student helper) I'm using mingw wich works fine with matlab libstdc++
and boost regex. But maybe there are others who need to handle this, so
for investigation...
... I compiled boost-1.33.1 by typing:
bjam -sTOOLS="gcc-stlport" -sSTLPORT_PATH="/usr/include/stlport/"
-sSTLPORT_VERSION="5.0.2" -sBUILD="release <runtime-link>dynamic
<stlport-iostream>on" stage
and adding a symbolic link
ln -s libstlport.so libstlport_gcc.so
in /usr/lib since boost links with -lstlport_gcc.
I'm using cmake where this is the CMakeList.txt file being relevant:
<CMakeList.txt>
set(incl_dirs ${incl_dirs} /usr/include/stlport )
set( incl_dirs ${incl_dirs} ../utils )
include_directories( ${incl_dirs} )
set(lib_dirs ${lib_dirs}
/home/maik/Eigene-Dateien/WZL/boost_1_33_1/bin/boost/libs/regex/build/libboost_regex.so/gcc-stlport/release/shared-linkable-true )
link_directories( ${lib_dirs} )
add_definitions(-D_REENTRANT )
add_executable(find_regex find_regex.cc)
target_link_libraries(find_regex
boost_regex-gcc-p-1_33_1
stlport
)
</CMakeList.txt>
Here is what gcc says:
<make output>
cd /home/maik/Eigene-Dateien/WZL/java_file_io/eclipse/C
++-Dateieinlesen/release/src/tests && /usr/bin/c++ -O2
-march=athlon-xp -mtune=athlon-xp -pipe -m3dnow -mmmx
-fomit-frame-pointer -momit-leaf-frame-pointer -fno-ident
-fvisibility-inlines-hidden -fPIC
"CMakeFiles/find_regex.dir/find_regex.o" -o find_regex -rdynamic
-L/home/maik/Eigene-Dateien/WZL/boost_1_33_1/bin/boost/libs/regex/build/libboost_regex.so/gcc-stlport/release/shared-linkable-true -lboost_regex-gcc-p-1_33_1 -lstlport -Wl,-rpath,/home/maik/Eigene-Dateien/WZL/boost_1_33_1/bin/boost/libs/regex/build/libboost_regex.so/gcc-stlport/release/shared-linkable-true
CMakeFiles/find_regex.dir/find_regex.o: In function
`boost::re_detail::perl_matcher<char const*,
stlp_std::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> >
>::perl_matcher(char const*, char const*, boost::match_results<char
const*, stlp_std::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags, char const*)':
find_regex.cc:(.text._ZN5boost9re_detail12perl_matcherIPKcN8stlp_std9allocatorINS_9sub_matchIS3_EEEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEC1ES3_S3_RNS_13match_resultsIS3_S8_EERKNS_11basic_regexIcSC_EENS_15regex_constants12_match_flagsES3_[boost::re_detail::perl_matcher<char const*, stlp_std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(char const*, char const*, boost::match_results<char const*, stlp_std::allocator<boost::sub_match<char const*> > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, char const*)]+0x86): undefined reference to `boost::re_detail::perl_matcher<char const*, stlp_std::allocator<boost::sub_match<char const*> >, 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_constants::_match_flags)'
CMakeFiles/find_regex.dir/find_regex.o: In function `bool
boost::regex_search<char const*,
stlp_std::allocator<boost::sub_match<char const*> >, char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*,
char const*, boost::match_results<char const*,
stlp_std::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags, char
const*)':find_regex.cc:(.text._ZN5boost12regex_searchIPKcN8stlp_std9allocatorINS_9sub_matchIS2_EEEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SC_RNS_13match_resultsISC_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESC_[bool boost::regex_search<char const*, stlp_std::allocator<boost::sub_match<char const*> >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*, char const*, boost::match_results<char const*, stlp_std::allocator<boost::sub_match<char const*> > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, char const*)]+0x6a): undefined reference to `boost::re_detail::perl_matcher<char const*, stlp_std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()'
CMakeFiles/find_regex.dir/find_regex.o: In function `void
boost::re_detail::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > >(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)':
find_regex.cc:(.text._ZN5boost9re_detail11raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[void boost::re_detail::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > >(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)]+0xda): undefined reference to `boost::re_detail::raise_runtime_error(stlp_std::runtime_error const&)'
collect2: ld returned 1 exit status
make[2]: *** [src/tests/find_regex] Error 1
make[2]: Leaving directory
`/home/maik/Eigene-Dateien/WZL/java_file_io/eclipse/C
++-Dateieinlesen/release'
make[1]: *** [src/tests/CMakeFiles/find_regex.dir/all] Error 2
make[1]: Leaving directory
`/home/maik/Eigene-Dateien/WZL/java_file_io/eclipse/C
++-Dateieinlesen/release'
make: *** [all] Error 2
</make output>
The source file:
<source>
#include <iostream>
#include <string>
#include <vector>
#include <boost/algorithm/string_regex.hpp>
using std::string;
using std::vector;
using boost::regex;
using boost::find_all_regex;
using boost::find_regex;
using boost::iterator_range;
int main(int argc, char** argv)
{
iterator_range<string::const_iterator> cv_result;
string str = "Drehmoment: 200.00 Nm 400.0 Nm";
// [0-9]*\.[0-9]* Nm
// \d{3}
regex e1("[0-9]*\\.[0-9]*.*Nm");
cv_result = find_regex(str,e1);
for (iterator_range<string::const_iterator>::iterator it =
cv_result.begin(); it != cv_result.end(); ++it)
{
std::cout << *it << std::endl;
}
vector<string> tokens;
find_all_regex(tokens,str,e1);
for (vector<string>::iterator it = tokens.begin(); it != tokens.end();
++it)
{
std::cout << *it << std::endl;
}
return 0;
}
</source>
If you want me to, I can try with boost-cvs.
Maik
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