std :: regex—リンクする必要のあるライブラリがありますか?

StackOverflow https://stackoverflow.com/questions/1623250

  •  06-07-2019
  •  | 
  •  

質問

次のコードでリンカーエラーが表示されます:

#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には既に正規表現が含まれています。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top