compiling only regex library
Hi ,
i want to use boost regex++ for my project but dont want to compile all
boost libraries for now,
so i compiled using option:
--with-regex
got no errors, and result library:
boost_regex-gcc-1_33_1.a
copied all boost_<version>/boost headers to $HOME/include
directory is like this:
$HOME/include/boost/regex.hpp
have a simple test.cpp file that uses:
boost::regex_search(...)
i compiled like this:
g++ -o trun test.cpp -I/home/ig3/include -L/home/ig3/lib
-lboost_regex-gcc-1_33_1
got following error:
test.cpp: In function `int main(int, char**)':
test.cpp:26: no matching function for call to `regex_search(
__gnu_cxx::__normal_iterator
I.B. wrote:
Hi ,
i want to use boost regex++ for my project but dont want to compile all boost libraries for now, so i compiled using option: --with-regex
got no errors, and result library: boost_regex-gcc-1_33_1.a
copied all boost_<version>/boost headers to $HOME/include
directory is like this: $HOME/include/boost/regex.hpp
have a simple test.cpp file that uses:
boost::regex_search(...)
i compiled like this: g++ -o trun test.cpp -I/home/ig3/include -L/home/ig3/lib -lboost_regex-gcc-1_33_1
got following error:
test.cpp: In function `int main(int, char**)': test.cpp:26: no matching function for call to `regex_search( __gnu_cxx::__normal_iterator
>&, __gnu_cxx::__normal_iterator >, boost::cmatch&, boost::regex&)' i wonder why is that. Thought iterator is a template that shouldnt be compiled. Headers should be enough.
You've mixed your iterators up: you are passing std::string::iterator's to the function, but using boost::cmatch to accept the result (cmatch expects a const char* and *not* a string::iterator). Use boost::smatch to accept the result instead. Note: with some std lib's, std::string::iterator happens to be the type const char* and your code would compile. You can not rely on this in general though. HTH, John.
yeas! it was iterator! it works now.
thanx,
igRek
On 12/16/06, John Maddock
I.B. wrote:
Hi ,
i want to use boost regex++ for my project but dont want to compile all boost libraries for now, so i compiled using option: --with-regex
got no errors, and result library: boost_regex-gcc-1_33_1.a
copied all boost_<version>/boost headers to $HOME/include
directory is like this: $HOME/include/boost/regex.hpp
have a simple test.cpp file that uses:
boost::regex_search(...)
i compiled like this: g++ -o trun test.cpp -I/home/ig3/include -L/home/ig3/lib -lboost_regex-gcc-1_33_1
got following error:
test.cpp: In function `int main(int, char**)': test.cpp:26: no matching function for call to `regex_search( __gnu_cxx::__normal_iterator
>&, __gnu_cxx::__normal_iterator >, boost::cmatch&, boost::regex&)' i wonder why is that. Thought iterator is a template that shouldnt be compiled. Headers should be enough.
You've mixed your iterators up: you are passing std::string::iterator's to the function, but using boost::cmatch to accept the result (cmatch expects a const char* and *not* a string::iterator). Use boost::smatch to accept the result instead.
Note: with some std lib's, std::string::iterator happens to be the type const char* and your code would compile. You can not rely on this in general though.
HTH,
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
I.B.
-
John Maddock