Boost::Xpressive compile puzzle under MinGW

大憨熊 提交于 2019-12-23 03:07:28

问题


Switching to GCC for the first time, and I'm getting a bit confused by what the compiler is telling me here. Essentially, it's behaving like boost::xpressive::wsregex is not defined (I believe).

Here is the relevant code:

#include "criterion.h"
#include <string>
#include <boost/xpressive/xpressive.hpp>

//More lines of code omitted here

class perlRegex : public regexClass
{
private:
    std::wstring regexString;
    boost::xpressive::wsregex regex;   // This is the line complained about
public:
    unsigned __int32 getPriorityClass() const;
    BOOL include(fileData &file) const;
    unsigned int directoryCheck(const std::wstring& /*directory*/) const;
    std::wstring debugTree() const;
    perlRegex(const std::wstring& inRegex);
};

And here is the error:

regex.h:46: error: using-declaration for non-member at class scope
regex.h:46: error: expected `;' before "regex"

What I'm confused about here is that I'm declaring a member, yet it complains that I'm using a member somewhere else.

Have I forgotten to #include something?

Thanks in advance, Billy3


回答1:


cygwin and mingw do not support wide characters, so xpressive can't either. See the following from xpressive_fwd.hpp:

#if defined(BOOST_NO_CWCHAR) | \
    defined(BOOST_NO_CWCTYPE) | \
    defined(BOOST_NO_STD_WSTRING)
# ifndef BOOST_XPRESSIVE_NO_WREGEX
#  define BOOST_XPRESSIVE_NO_WREGEX
# endif
#endif

The macros BOOST_NO_CWCHAR, BOOST_NO_CWCTYPE and BOOST_NO_STD_WSTRING are defined automatically by boost's config.hpp header for your platcorm/compiler/std-library. Sorry.

In the future, you'll get better results posting boost questions to the boost users' list.

-- Eric Niebler BoostPro Computing www.boostpro.com



来源:https://stackoverflow.com/questions/1616855/boostxpressive-compile-puzzle-under-mingw

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!