STD :: Regex - 연결해야 할 LIB가 있습니까?
문제
다음 코드로 링커 오류가 발생합니다.
#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
Regex를 사용하려면 Boost 라이브러리를 설치할 수 있으며 TR1에는 이미 Regex가 포함되어 있습니다.
제휴하지 않습니다 StackOverflow