std :: regex & # 8212; ¿hay alguna lib que deba vincularse?
Pregunta
Recibo un error de vinculador con el siguiente código:
#include <regex>
int main()
{
std::regex rgx("ello");
return 0;
}
test.o: In function `basic_regex':
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../../include/c++/4.4.1/tr1_impl/regex:769: undefined reference to `std::basic_regex<char, std::regex_traits<char> >::_M_compile()'
collect2: ld returned 1 exit status
Solución
De gcc-4.4.1/include/c++/4.4.1/tr1_impl/regex
template <...>
class basic_regexp {
...
private:
/**
* @brief Compiles a regular expression pattern into a NFA.
* @todo Implement this function.
*/
void _M_compile();
Supongo que aún no está listo.
ACTUALIZACIÓN: el GCC actual (SVN @ 153546) no parece tener la implementación todavía.
Otros consejos
puede obtener el estado de implicación de: http: //gcc.gnu. org / onlinedocs / libstdc ++ / manual / bk01pt01ch01.html # manual.intro.status.standard.tr1
para usar regex, puede instalar boost library y su tr1 ya ha incluido regex.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow