I am having a problem compiling a program in Visual Studio 2010, on a windows 7 computer. I get the below errors when I compile in Release mode, but not in Debug mode. I have carefully checked all the property settings for both modes, and they are the same, except for where they have to be different; the code generation setting is /MD for Runtime, and /MDd for Debug, the same settings that I compiled the wxWidgets (2.8.12) libraries under, and the names of the wxWidgets libraries are slightly different. As I say, I have no problem compiling and running my program in Debug mode, or running wxWidgets samples in either mode. I also am linking to wxMathPlot, which is a wxWidgets add-on, I don't know if that is relevant. I can run the debug or release versions of wxMathPlot samples.
Now Microsoft has a little bit of information on these compiler errors, but nothing that helped me too much:
http://msdn.microsoft.com/en-us/library/3ys51zwc(v=vs.71).aspx http://msdn.microsoft.com/en-us/library/sksadsda.aspx
This statement seems relevant: "You may also get C2011 if you import a type library more than once into the same file"
Except that I don't know what that means, or how I might be doing it. It seems curious that I would be doing it for one mode and not the other. Has anyone seen this problem and know how to overcome it?
Thanks Phil
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
Here is a piece of code that it is complaining about from the unknwn.h file, starting on line 124:
template<class Q>
HRESULT
#ifdef _M_CEE_PURE
__clrcall
#else
STDMETHODCALLTYPE
#endif
QueryInterface(Q** pp)
{
return QueryInterface(__uuidof(Q), (void **)pp);
}