代码之家  ›  专栏  ›  技术社区  ›  manidos

正则表达式代码无缘无故停止工作

  •  0
  • manidos  · 技术社区  · 8 年前

    以前工作过

    #include <regex>
    
    using namespace std;
    
    int main(int argc, char** argv) {
        regex txt_regex("[a-z]+\\.txt");
        return 0;
    }
    

    错误日志 来自netbeans:

    cd '/home/dev/Desktop/test'
    /usr/bin/make -f Makefile CONF=Debug
    "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
    make[1]: Entering directory '/home/dev/Desktop/test'
    "/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/test
    make[2]: Entering directory '/home/dev/Desktop/test'
    mkdir -p build/Debug/GNU-Linux
    rm -f "build/Debug/GNU-Linux/main.o.d"
    g++    -c -g -std=c++11 -MMD -MP -MF "build/Debug/GNU-Linux/main.o.d" -o build/Debug/GNU-Linux/main.o main.cpp
    In file included from /usr/include/c++/5/regex:60:0,
                     from main.cpp:1:
    /usr/include/c++/5/bits/regex_compiler.h: In member function ‘bool std::__detail::_AnyMatcher<_TraitsT, false, __icase, __collate>::operator()(std::__detail::_AnyMatcher<_TraitsT, false, __icase, __collate>::_CharT) const [with _TraitsT = std::__cxx11::regex_traits<char>; bool __icase = true; bool __collate = false; std::__detail::_AnyMatcher<_TraitsT, false, __icase, __collate>::_CharT = char]’:
    /usr/include/c++/5/bits/regex_compiler.h:292:7: internal compiler error: Segmentation fault
           operator()(_CharT __ch) const
           ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
    nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/GNU-Linux/main.o' failed
    make[2]: *** [build/Debug/GNU-Linux/main.o] Error 1
    make[2]: Leaving directory '/home/dev/Desktop/test'
    nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed
    make[1]: *** [.build-conf] Error 2
    make[1]: Leaving directory '/home/dev/Desktop/test'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
    make: *** [.build-impl] Error 2
    
    BUILD FAILED (exit value 2, total time: 1s)
    

    1 回复  |  直到 8 年前
        1
  •  0
  •   manidos    8 年前

    在我更新系统后,代码再次生效:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    
    推荐文章