std :: regex—リンクする必要のあるライブラリがありますか?
質問
次のコードでリンカーエラーが表示されます:
#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
解決
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();
まだ準備ができていないようです。
更新:現在の最先端のGCC(SVN @ 153546)にはまだ実装されていないようです。
他のヒント
以下から実装ステータスを取得できます。 http://gcc.gnu。 org / onlinedocs / libstdc ++ / manual / bk01pt01ch01.html#manual.intro.status.standard.tr1
正規表現を使用するには、boostライブラリをインストールできます。tr1には既に正規表現が含まれています。
所属していません StackOverflow