Windows 7 コンピューターの Visual Studio 2010 でプログラムをコンパイルする際に問題が発生しています。リリース モードでコンパイルすると、次のエラーが発生しますが、デバッグ モードでは発生しません。両方のモードのすべてのプロパティ設定を注意深く確認しましたが、異なる必要がある場所を除いて同じです。コード生成設定は、ランタイムの場合は /MD、デバッグの場合は /MDd で、wxWidgets (2.8.12) ライブラリをコンパイルしたときと同じ設定で、wxWidgets ライブラリの名前は少し異なります。私が言うように、デバッグ モードでプログラムをコンパイルして実行することも、どちらのモードで wxWidgets サンプルを実行することも問題ありません。また、wxWidgets アドオンである wxMathPlot にもリンクしていますが、それが関連しているかどうかはわかりません。wxMathPlot サンプルのデバッグ バージョンまたはリリース バージョンを実行できます。
現在、Microsoft はこれらのコンパイラ エラーに関する情報を少し持っていますが、あまり役に立ちませんでした。
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
以下は、124 行目から始まる unknwn.h ファイルのコードの一部です。
template<class Q>
HRESULT
#ifdef _M_CEE_PURE
__clrcall
#else
STDMETHODCALLTYPE
#endif
QueryInterface(Q** pp)
{
return QueryInterface(__uuidof(Q), (void **)pp);
}