【问题标题】:Boost::Xpressive compile puzzle under MinGWMinGW下的Boost::Xpressive编译拼图
【发布时间】:2009-10-24 03:33:27
【问题描述】:

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

以下是相关代码:

#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"

我在这里感到困惑的是,我声明了一个成员,但它抱怨我在其他地方使用了一个成员。

我忘记#include 什么了吗?

提前致谢, 比利3

【问题讨论】:

  • 我假设在criteria.h或前面省略的代码中都有regexClass的定义?
  • 是的,它是criteria.h中的#defined。
  • 您能否确保标头搜索路径正确,即 Boost 库正确包含在您的源代码中?
  • 其他 boost 库运行正常。

标签: c++ mingw boost-xpressive


【解决方案1】:

cygwin 和 mingw 不支持宽字符,所以 xpressive 也不支持。请参阅 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 由 boost 的 config.hpp 头文件为您的 platcorm/compiler/std-library 自动定义。对不起。

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

-- 埃里克·尼布勒 BoostPro 计算 www.boostpro.com

【讨论】:

  • 猜猜我被微软的编译器困住了:(
  • 哇!不是每天你都能从图书馆的作者那里得到答案。再次感谢:)
猜你喜欢
  • 2016-06-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多