2011-12-19 19 views
8

mogę utworzyć plik .o g ++ -c test.cpp -std = C++ 0x, ale połączyć go mogę, mam następujące błędy:kompilacji std :: regex_iterator z gcc

test.cpp:(.text+0xe5): undefined reference to `std::regex_iterator<char const*, char, std::regex_traits<char> >::regex_iterator(char const*, char const*, std::basic_regex<char, std::regex_traits<char> > const&, std::bitset<11u>)' 
test.cpp:(.text+0xf1): undefined reference to `std::regex_iterator<char const*, char, std::regex_traits<char> >::regex_iterator()' 

Code :

#include <regex> 
#include <iostream> 

#include <string.h> 

typedef std::regex_iterator<const char *> Myiter; 
int main() 
{ 
    const char *pat = "axayaz"; 
    Myiter::regex_type rx("a"); 
    Myiter next(pat, pat + strlen(pat), rx); 
    Myiter end; 


    return (0); 
} 
+1

Która wersja GCC? '' nie jest zaimplementowane do wersji 4.6.2. Dlaczego zamiast tego nie używaj 'std :: cregex_iterator'? –

+0

@Kerrek SB, 4.6.1 – Yola

+1

czy rozważałeś użycie bibliotek boost regex? Zarówno boost :: regex, jak i :: xpressive są w pełni funkcjonalne. – mark

Odpowiedz

Powiązane problemy