English 中文(简体)
标识符 : 重新定义错误 (错误 C2011 & 错误 C2370)
原标题: identifier : redefinition errors ( error C2011 & error C2370)

每次我试图编译我的代码时, 我就会发现大量错误。 这与我的代码没有问题, 因为它在另一台计算机上运作良好。 我尝试过重新安装和修补, 但是这没有帮助。 这里的错误信息是整个错误信息 :

1>------ Build started: Project: Raptor Triangle 2, Configuration: Debug Win32 ------
1>  Raptor Triangle 2.cpp
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(57): error C2011:  vc_attributes::YesNoMaybe  :  enum  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(57) : see declaration of  vc_attributes::YesNoMaybe 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(67): error C2011:  vc_attributes::AccessType  :  enum  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(67) : see declaration of  vc_attributes::AccessType 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(81): error C2011:  vc_attributes::Pre  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(81) : see declaration of  vc_attributes::Pre 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(78): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(112): error C2011:  vc_attributes::Post  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(112) : see declaration of  vc_attributes::Post 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(109): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(143): error C2011:  vc_attributes::FormatString  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(143) : see declaration of  vc_attributes::FormatString 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(155): error C2011:  vc_attributes::InvalidCheck  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(155) : see declaration of  vc_attributes::InvalidCheck 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(152): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(165): error C2011:  vc_attributes::Success  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(165) : see declaration of  vc_attributes::Success 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(176): error C2011:  vc_attributes::PreBound  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(176) : see declaration of  vc_attributes::PreBound 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(173): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(186): error C2011:  vc_attributes::PostBound  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(186) : see declaration of  vc_attributes::PostBound 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(183): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(196): error C2011:  vc_attributes::PreRange  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(196) : see declaration of  vc_attributes::PreRange 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(193): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(208): error C2011:  vc_attributes::PostRange  :  struct  type redefinition
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(208) : see declaration of  vc_attributes::PostRange 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(205): error C3094:  repeatable : anonymous usage not allowed
1>          e:programsc++
aptor triangle 2
aptor triangle 2predefined c++ attributes (compiler internal)(147) : see declaration of  repeatable 
1>          attribute can only be applied to:  class ,  struct 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(245): error C2370:  SA_Yes  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(245) : see declaration of  SA_Yes 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(246): error C2370:  SA_No  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(246) : see declaration of  SA_No 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(247): error C2370:  SA_Maybe  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(247) : see declaration of  SA_Maybe 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(250): error C2370:  SA_NoAccess  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(250) : see declaration of  SA_NoAccess 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(251): error C2370:  SA_Read  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(251) : see declaration of  SA_Read 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(252): error C2370:  SA_Write  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(252) : see declaration of  SA_Write 
1>c:program files (x86)microsoft visual studio 10.0vcincludecodeanalysissourceannotations.h(253): error C2370:  SA_ReadWrite  : redefinition; different storage class
1>          c:program filesmicrosoft visual studio 10.0vcincludecodeanalysissourceannotations.h(253) : see declaration of  SA_ReadWrite 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

哈哈,我不明白,我查了错误代码,但不知道该怎么办

而且,我可以发布代码,如果需要的话, 但它相当长。

我解决了,但我不明白为什么。我摆脱了我的线路,把窗户也包括进去,我睡觉时需要的窗户。我还是不明白为什么这很重要。

最佳回答

对象文件必须过期。 尝试一个干净的构建 - 即清洁/ 建筑 。 windows. h 应该与它无关 。

问题回答

C2370的另一个原因是当包含一个常数的页眉文件存在多份副本时。

不同的工程随后访问同一页眉文件的不同副本, 打破 #pragma 一次, 并导致 C2370 重新定义; 不同的存储类 。

重复文件的一个常见原因是,当开发商在当地制作一份附属图书馆页眉副本,而全球可访问的SDK仍然存在时,文件就会重复。

您需要形成以下页眉文件 :

#ifndef HEADERFILENAME_DEF
#define HEADERFILENAME_DEF

/* all declarations here */

#endif

这将防止双倍包含页眉文件 。

我对VS2008也有同样的问题,我解决了:

change Yes (/Wp64) --> No




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签