[ACXFAQ017]
Visual C++ Compiler Error C2525 when using #Import Directive and iDispatch, duplicate member functions.


This issue occurs when Visual C++ attempts to import one of our TLB files when generating the TLH wrapper file during processing of the #IMPORT compiler directive...

Original #Import Directive
#import "iProfessionalLibrary.tlb" named_guids
Sample Error Message
--------------------Configuration: iDispatchiLedMatrix - Win32 Debug--------------------
Compiling...
iDispatchiLedMatrixDlg.cpp
c:\test\debug\iprofessionallibrary.tlh(7446) : error C2535: 'long __thiscall iProfessionalLibrary::IiPieChartX::GetItemCount(void)' : member function already defined or declared
c:\test\debug\iprofessionallibrary.tlh(7382) : see declaration of 'GetItemCount'
c:\test\debug\iprofessionallibrary.tlh(7972) : error C2535: 'long __thiscall iProfessionalLibrary::IiPercentBarX::GetItemCount(void)' : member function already defined or declared
c:\test\debug\iprofessionallibrary.tlh(7908) : see declaration of 'GetItemCount'
Error executing cl.exe.

iDispatchiLedMatrix.exe - 2 error(s), 0 warning(s)

To fix this issue, simply utilize the rename attribute of the #import directive to rename the offending member function to something else. This is a problem with the Visual C++ parser's inability to automatically work around this problem, though it is easily fixed. If you use that particular member function, remember that you will need to use the renamed member function spelling instead (i.e. if you want to use the GetItemCount method of one of our components where you renamed the member function, you will need to call GetItemCountX instead.)...

Fixed #Import Directive
#import "iProfessionalLibrary.tlb" named_guids rename("GetItemCount","GetItemCountX")

Copyright ©1998-2007 Iocomp Software Incorporated. Iocomp and the Iocomp Logo are registered trademarks of Iocomp Software Inc. All other trademarks are registered by their respective owners.