|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Junior Member
Iscritto dal: Oct 2011
Messaggi: 23
|
[C++] Problemi con le regular expression (libreria boost)
Salve ragazzi, ho provato ad eseguire questo programma (con eclipse) ma non riesco a compilarlo, ho installato le librerie boost ma il programma non parte
#include <boost/regex.hpp> #include <string> int main() { boost::regex pattern ("ao"); std::string stringa ("Paolo Elefante"); if (boost::regex_search (stringa, pattern) printf ("found\n"); else printf("not found\n"); return 0; } |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Mar 2007
Città: Milano Beach
Messaggi: 1696
|
Le boost sono installate correttamente? Hai configurato il linker affinchè possa trovare libboost_regex?
__________________
~ Cthulhu: MacBookPro 13.3" ~ Azathoth: D510MO |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Sep 2006
Messaggi: 1539
|
Boost è quasi completamente composto da librerie header (che non hanno bisogno di librerie compilate a parte)
Tranne ovviamente alcune come Boost regex. Oltre a ovviamente dover postare il tuo errore di compilazione hai 2 possibilità 1) compilare boost, non banale 2) usare i precompilati (cerca boost pro su internet) Se non hai chiaro quello che ho scritto sopra devi cercare documentazione sul compiler / linker e capire cosa sono |
|
|
|
|
|
#4 |
|
Junior Member
Iscritto dal: Oct 2011
Messaggi: 23
|
Buongiorno a tutti, dopo aver scritto quel semplice programma nel make file ho inserito le seguenti istruzioni
CINCLUDES += -I"$(BOOST_SDK_INC)" LIBSDIR += -L"$(BOOST_SDK_LIB)" dove nel file common.mk # BOOST SDK BOOST_SDK_PATH = $(IODEV_VOB)/BOOST_SDK/boost_1_44_0 BOOST_SDK_LIB = $(BOOST_SDK_PATH)/lib BOOST_SDK_INC = $(BOOST_SDK_PATH)/include export BOOST_SDK_PATH #BOOST_LIBS = dopo aver compilato il programma mi esce questo erroe: .//program.obj: In function `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int)': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/basic_regex.hpp:425: undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)' .//program.obj: In function `perl_matcher': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher.hpp:371: undefined reference to `boost::re_detail: .//program.obj: In function `bool boost::regex_search<__gnu_cxx::__normal_iterator<char 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::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/regex_search.hpp:145: undefined reference to `boost::re_detail: .//program.obj: In function `save_state_init': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher_non_recursive.hpp:107: undefined reference to `boost::re_detail::get_mem_block()' .//program.obj: In function `boost::cpp_regex_traits<char>::transform(char const*, char const*) const': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/cpp_regex_traits.hpp:908: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const' .//program.obj: In function `boost::cpp_regex_traits<char>::transform_primary(char const*, char const*) const': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/cpp_regex_traits.hpp:912: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const' .//program.obj: In function `boost::re_detail::cpp_regex_traits_implementation<char>::error_string(boost::regex_constants::error_type) const': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/cpp_regex_traits.hpp:442: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)' /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/cpp_regex_traits.hpp:444: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)' .//program.obj: 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)': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/pattern_except.hpp:75: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)' .//program.obj: In function `boost::re_detail: /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher_non_recursive.hpp:213: undefined reference to `boost::re_detail::get_mem_block()' .//program.obj: In function `boost::re_detail: /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher_non_recursive.hpp:973: undefined reference to `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> > > > > >::maybe_assign(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> > > > > > const&)' .//program.obj: In function `boost::re_detail: /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher_non_recursive.hpp:1117: undefined reference to `boost::re_detail: .//program.obj: In function `~save_state_init': /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher_non_recursive.hpp:115: undefined reference to `boost::re_detail: .//program.obj: In function `boost::re_detail: /vobs/IO_Developments/BOOST_SDK/boost_1_44_0/include/boost/regex/v4/perl_matcher_common.hpp:292: undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)' collect2: ld returned 1 exit status make: *** [wizard] Error 1 secondo voi devo aggiungere qualcosa nel makefile? |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 19:55.



















