boost/regex/v4/regex_变通方法;大小单位';未在此范围中声明

boost/regex/v4/regex_变通方法;大小单位';未在此范围中声明,regex,boost,Regex,Boost,当我用boost regex编译我的程序时,我得到一个编译错误,如下所示: In file included from /usr/local/include/boost/regex/v4/regex.hpp:32:0, from /usr/local/include/boost/regex.hpp:31, from ProcessAffinityManager.cpp:38: /usr/local/include/boost/regex/v4/

当我用boost regex编译我的程序时,我得到一个编译错误,如下所示:

In file included from /usr/local/include/boost/regex/v4/regex.hpp:32:0, from /usr/local/include/boost/regex.hpp:31, from ProcessAffinityManager.cpp:38: /usr/local/include/boost/regex/v4/regex_workaround.hpp: In function 'size_t boost::re_detail::strcpy(char*, const char*)': /usr/local/include/boost/regex/v4/regex_workaround.hpp:199:37: error: 'sizeInBytes' was not declared in this scope 在/usr/local/include/boost/regex/v4/regex.hpp:32:0中包含的文件中, from/usr/local/include/boost/regex.hpp:31, 从ProcessAffinityManager.cpp:38: /usr/local/include/boost/regex/v4/regex\u workaround.hpp:在函数“size\u t boost::re\u detail::strcpy(char*,const char*)”中: /usr/local/include/boost/regex/v4/regex_变通方法。hpp:199:37:错误:“sizeInBytes”未在此范围内声明
但是当我检查源文件时,
regex\u workaround.hpp
sizeInBytes
是一个参数,错误不应该出现在这里。

我同意评论员的观点,需要更多信息

但是,我在使用MingW4.8.1的项目中遇到了完全相同的问题 经过一点调查,我发现有人在我们的项目中添加了一个类似的宏黑客:

#define strcpy_s(A,B,C) strcpy(A,C)
我想这是为了解决VS和MinGW之间的兼容性问题。VS定义了许多C字符串函数的“安全”版本,例如strcpy_s(A、B、C)。 在windows上编译时,许多库都使用这些版本的函数,但是旧版本的VS和MinGW缺少这些函数

regex通过尝试为可能缺少strcpy的环境定义strcpy来解决这个问题。它与试图强迫strcpy_调用使用strcpy的丑陋黑客行为相冲突


如果你的问题和我的一样,那么解决方案就是找到谁添加了strcpy_的hack,然后转向提供这样一个函数的解决方案

我认为我们需要更多信息,比如什么版本的boost、什么编译器和一个示例程序。