Pcrecpp析构函数

Pcrecpp destructor

int main(int argc, char* argv[])
{
   std::string s1;
   pcrecpp::RE re("(.*)");
   re.PartialMatch("This is a test progream", &s1);

   return 0;
}

我想将匹配结果存储到s1,但是我在运行程序时,出现错误:

这是堆栈跟踪信息:

pcrecpp 版本:8.36
编译器:vs2005

我找到了解决这个问题的更好方法。由于 pcrecpp.dll 将 malloc 内存,这将导致 windows 上的错误。所以,首先,我构建 pcre.dll;然后将pcrecpp文件添加到我的项目中,从而解决内存malloc问题。 以 pcre.8.36 为例: 1.使用pcre文件生成pcre.dll:

pcre_byte_order.c
pcre_chartables.c
pcre_compile.c
pcre_config.c
pcre_dfa_exec.c
pcre_exec.c
pcre_fullinfo.c
pcre_get.c
pcre_globals.c
pcre_jit_compile.c
pcre_maketables.c
pcre_newline.c
pcre_ord2utf8.c
pcre_refcount.c
pcre_string_utils.c
pcre_study.c
pcre_tables.c
pcre_ucd.c
pcre_valid_utf8.c
pcre_version.c
pcre_xclass.c

pcre.h
pcre_internal.h
ucp.h
config.h
  1. 添加

    pcre_scanner.cpp pcre_stringpiece.cpp pcrecpp.cpp pcre_scanner.h pcre_stringpiece.h pcrecpparg.h
    到我的项目,OK!