1

当我使用 boost regex 编译程序时,出现如下编译错误:

在 /usr/local/include/boost/regex/v4/regex.hpp:32:0 包含的文件中,
             来自 /usr/local/include/boost/regex.hpp:31,
             来自 ProcessAffinityManager.cpp:38:
/usr/local/include/boost/regex/v4/regex_workaround.hpp:在函数“size_t boost::re_detail::strcpy(char*, const char*)”中:
/usr/local/include/boost/regex/v4/regex_workaround.hpp:199:37:错误:未在此范围内声明“sizeInBytes”

但是当我检查源文件时regex_workaround.hppsizeInBytes是一个参数,错误不应该在这里。

4

1 回答 1

0

I agree with the commentator that more info is required..

However I had the exact same issue in a project I am working on using minGW 4.8.1 After a little investigation I found that someone added a macro hack to our project of the sort:

#define strcpy_s(A,B,C) strcpy(A,C)

The idea I guess was to solve a compatibility issue with between VS and MinGW. VS defines "secure" versions of many C string functions such as strcpy_s(A,B,C). A lot of libraries when compiling on windows use these versions of the functions, however they are missing for older versions of VS and for MinGW

Boost::regex solves this issue by trying to define a strcpy_s for environments that might miss it. It clashes with the ugly hack of trying to force strcpy_s calls to use strcpy

If your problem is like mine the solution is to find who added the strcpy_s hack and move to a solution of providing such a function

于 2015-02-05T11:33:24.043 回答