visual-c++ - 如何针对VES2008编译Greta?

我针对VES2008编译了Greta,报告

error C2332: 'class' : missing tag name                                           
error C3306: 'regex::detail::<unnamed-tag>': unnamed class template is not allowed
error C2143: syntax error : missing ';' before '__builtin_alignof'                
error C2059: syntax error : '__builtin_alignof'                                   
error C2143: syntax error : missing ';' before '{'                                
error C2447: '{' : missing function header (old-style formal list?)               

相关的源代码片段:
template< typename T >
class alignof
{
    struct helper
    {
        helper();
        char    m_c;
        T       m_t;
    };
public:
    enum { value = sizeof(helper)-sizeof(T) < sizeof(T) ? sizeof(helper)-sizeof(T) : sizeof(T) };
};

预编译后,
template< typename T >
class __alignof
{
    struct helper
    {
        helper();
        char    m_c;
        T       m_t;
    };
public:
    enum { value = sizeof(helper)-sizeof(T) < sizeof(T) ? sizeof(helper)-sizeof(T) : sizeof(T) };
};

谷歌搜索后,我还没有找到答案。是什么原因造成的,以及如何解决?

最佳答案

尽管alignof在VS2008中似乎不是保留字,但它与 _alignof 极为相似,可能会使问题感到困惑。

尝试将您的类(class)名称更改为其他名称。

https://stackoverflow.com/questions/15892661/

相关文章:

android - 如何解决java.lang.NoClassDefFoundError

xcode - Intel C++编译器,无法在OS X上打开stdarg.h

compiler-errors - 错误: no newline at end of file [-

android - 如何解决Java Eclipse中的 “The hierarchy of the

perl - "error: variable length array of non-POD el

vba - 具有多个条件的Select Case函数不循环

compiler-errors - 来自gtest-all.cc的Google测试编译错误

python - python err : Local variable referenced be

android - Android Studio 0.2.1错误

compiler-errors - 类型提供程序的 Mono FSharpC 错误