MinGW下的Boost :: Xpressive编译难题

Bil*_*eal 1 c++ mingw boost-xpressive

第一次切换到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);
};
Run Code Online (Sandbox Code Playgroud)

这是错误:

regex.h:46: error: using-declaration for non-member at class scope
regex.h:46: error: expected `;' before "regex"
Run Code Online (Sandbox Code Playgroud)

我在这里感到困惑的是,我宣布成员,但它抱怨我在其他地方使用其他成员.

我忘记了#include什么吗?

在此先感谢Billy3

Eri*_*ler 5

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
Run Code Online (Sandbox Code Playgroud)

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

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

- Eric Niebler BoostPro Computing www.boostpro.com

  • 哇!不是每天都能从图书馆的作者那里得到答案.再次感谢 :) (2认同)