Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. VC++ import dll command causes error C2872 'ambiguous symbol' in comdefsp.h

VC++ import dll command causes error C2872 'ambiguous symbol' in comdefsp.h

Scheduled Pinned Locked Moved Managed C++/CLI
c++csharpdotnetvisual-studio
2 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    devguy24
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • D devguy24

      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

      M Offline
      M Offline
      Member 2595383
      wrote on last edited by
      #2

      since 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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups