2

我在 Windows 7 计算机上编译 Visual Studio 2010 中的程序时遇到问题。在发布模式下编译时出现以下错误,但在调试模式下没有。我仔细检查了两种模式的所有属性设置,它们是相同的,除了它们必须不同的地方;代码生成设置是/MD for Runtime,/MDd for Debug,和我编译wxWidgets(2.8.12)库的设置相同,wxWidgets库的名称略有不同。正如我所说,我在调试模式下编译和运行我的程序,或者在任一模式下运行 wxWidgets 示例都没有问题。我还链接到 wxMathPlot,这是一个 wxWidgets 插件,我不知道这是否相关。我可以运行 wxMathPlot 示例的调试或发布版本。

现在微软有一些关于这些编译器错误的信息,但没有什么对我有太大帮助:

http://msdn.microsoft.com/en-us/library/3ys51zwc(v=vs.71).aspx http://msdn.microsoft.com/en-us/library/sksadsda.aspx

此声明似乎相关:“如果您将类型库多次导入同一个文件,您也可能会获得 C2011”

除了我不知道这意味着什么,或者我可能会怎么做。我会为一种模式而不是另一种模式做这件事似乎很奇怪。有没有人看到这个问题并知道如何克服它?

谢谢菲尔

1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(124): error C2332: 'class' : missing tag name
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(124): error C2011: '<unnamed-tag>' : 'enum' type redefinition
1>          C:\WXWIDGETS\wxWidgets-2.8.12\include\wx/app.h(48) : see declaration of '<unnamed-tag>'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(124): error C2059: syntax error : 'constant'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(125): error C2143: syntax error : missing ')' before '>'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(131): error C2065: 'pp' : undeclared identifier
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(134): warning C4229: anachronism used : modifiers on data are ignored
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(134): error C2365: 'IUnknown::QueryInterface' : redefinition; previous definition was 'member function'
1>          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(116) : see declaration of 'IUnknown::QueryInterface'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(134): error C2998: 'HRESULT QueryInterface' : cannot be a template definition
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(316): error C2989: 'AsyncIUnknown' : class template has already been declared as a non-class template
1>          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(59) : see declaration of 'AsyncIUnknown'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(434): error C2989: 'IClassFactory' : class template has already been declared as a non-class template
1>          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(65) : see declaration of 'IClassFactory'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.h(269): error C2989: 'IRpcChannelBuffer' : class template has already been declared as a non-class template
1>          c:\program files (x86)\microsoft sdks\windows\v7.0a\include\rpcndr.h(708) : see declaration of 'IRpcChannelBuffer'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.h(305): error C2989: 'IRpcStubBuffer' : class template has already been declared as a non-class template
1>          c:\program files (x86)\microsoft sdks\windows\v7.0a\include\rpcndr.h(2489) : see declaration of 'IRpcStubBuffer'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.h(653): error C2143: syntax error : missing ';' before 'identifier'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.h(653): warning C4091: 'typedef ' : ignored on left of '_COSERVERINFO' when no variable is declared
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.h(653): fatal error C1075: end of file found before the left brace '{' at 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.h(595)' was matched

这是从 unknwn.h 文件中抱怨的一段代码,从第 124 行开始:

template<class Q>
  HRESULT
#ifdef _M_CEE_PURE
  __clrcall
#else
  STDMETHODCALLTYPE
#endif
QueryInterface(Q** pp)
{
  return QueryInterface(__uuidof(Q), (void **)pp);
}
4

0 回答 0