本文介绍了Boost :: Xpressive在MinGW下的编译难题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次切换到GCC,我对编译器在这里告诉我有点困惑。基本上,它的行为像boost :: xpressive :: wsregex没有定义(我相信)。

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).

这里是相关的代码:

#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);
};

这里是错误:

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.

我忘记了 #include 什么?

提前感谢,
Billy3

Thanks in advance,Billy3

推荐答案

cygwin和mingw不支持宽字符xpressive也不能。从xpressive_fwd.hpp中查看以下内容:

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

宏BOOST_NO_CWCHAR,BOOST_NO_CWCTYPE和BOOST_NO_STD_WSTRING由platcorm / compiler / std-library的boost的config.hpp标头自动定义。

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.

以后,您会得到更好的结果,将提升问题发布到boost用户列表中。

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

-
Eric Niebler
BoostPro Computing
www.boostpro.com

--Eric NieblerBoostPro Computingwww.boostpro.com

这篇关于Boost :: Xpressive在MinGW下的编译难题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 07:27