我编译了Greta来对抗VES2008,它说
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) };
};我在谷歌上搜索后还没有找到答案。这是什么原因造成的,如何解决?
发布于 2013-04-09 13:03:21
尽管alignof似乎不是VS2008中的保留字,但它与_alignof如此相似,可能会混淆问题。
尝试将类的名称更改为其他名称。
https://stackoverflow.com/questions/15892661
复制相似问题