VC++ import dll command causes error C2872 'ambiguous symbol' in comdefsp.h
-
Hello everyone, so I'm using VC++ 2008 and I've got a large solution made up of several different interconnected projects, some of which are DLL's (no CLR). In one of these DLL's I'm trying to import an EXTERNAL Visual Basic dll using the command #import "C:\path\to\my\DLL\file.dll" . If I use this command in one of my .cpp files, it works. If on the other hand, I use it in one of my .h files, I then get the following compile errors in the files ocidl.h and comdefsp.h. I noticed that the .tlh and .tli files generated by the #import command include the file comdef.h. There are other files in my project that include the file comdef.h. Could this be the reason for the conflict?
Error 1236 "solution_name" error C2872: 'IDropTarget' : ambiguous symbol C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ocidl.h 3949
Error 1237 "solution_name" error C2872: 'IServiceProvider' : ambiguous symbol C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ocidl.h 6238
Error 1238 "solution_name" error C2872: 'IDataObject' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 216
Error 1239 "solution_name" error C2872: 'IDataObject' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 216
Error 1240 "solution_name" error C2872: 'IDropTarget' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 246
Error 1242 "solution_name" error C2872: 'IMessageFilter' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 771
Error 1243 "solution_name" error C2872: 'IMessageFilter' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 771
Error 1244 "solution_name" error C2872: 'IServiceProvider' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 1041
Error 1245 "solution_name" error C2872: 'IServiceProvider' : ambiguous -
Hello everyone, so I'm using VC++ 2008 and I've got a large solution made up of several different interconnected projects, some of which are DLL's (no CLR). In one of these DLL's I'm trying to import an EXTERNAL Visual Basic dll using the command #import "C:\path\to\my\DLL\file.dll" . If I use this command in one of my .cpp files, it works. If on the other hand, I use it in one of my .h files, I then get the following compile errors in the files ocidl.h and comdefsp.h. I noticed that the .tlh and .tli files generated by the #import command include the file comdef.h. There are other files in my project that include the file comdef.h. Could this be the reason for the conflict?
Error 1236 "solution_name" error C2872: 'IDropTarget' : ambiguous symbol C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ocidl.h 3949
Error 1237 "solution_name" error C2872: 'IServiceProvider' : ambiguous symbol C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ocidl.h 6238
Error 1238 "solution_name" error C2872: 'IDataObject' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 216
Error 1239 "solution_name" error C2872: 'IDataObject' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 216
Error 1240 "solution_name" error C2872: 'IDropTarget' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 246
Error 1242 "solution_name" error C2872: 'IMessageFilter' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 771
Error 1243 "solution_name" error C2872: 'IMessageFilter' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 771
Error 1244 "solution_name" error C2872: 'IServiceProvider' : ambiguous symbol c:\program files (x86)\microsoft visual studio 9.0\vc\include\comdefsp.h 1041
Error 1245 "solution_name" error C2872: 'IServiceProvider' : ambiguoussince IDropTarget is a type, and it is referenced in ocidl.h, 'ambiguous' implies two definitions for the same, one must not disclude that the two definitions ARE the same and this would point to the common error of an include file, including itself. An include file should never include itself! But include files are notorious for including themselves vis-à-vis other include files. While it is of poor craftsmanship, it IS promoted in K&R C manual itself when they proscribe something akin to: #IFNDEF THISFILENOTALREADYREAD #define THISFILENOTALREADYREAD .... your h file: 'thisfile' ... #ENDIF If this is not the case, kindly submit the result of this search complete solution 'IDropTarget' Also, there is a switch you can throw that will indicate the include files as they are included. That would be helpful. Daniel Kilsdonk