VES2008中的greta编译错误

时间:2013-04-09 03:14:21

标签: visual-c++ compiler-errors

我根据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) };
};

谷歌搜索后我没有找到答案。是什么导致了这个以及如何解决它? T.I.A

1 个答案:

答案 0 :(得分:0)

虽然alignof似乎不是VS2008中的保留字,但它与_alignof非常相似,可能会使问题混乱。

尝试将班级名称更改为其他名称。