w0wbagger 3 Posted yesterday at 05:47 PM Hey folks, I imported the Type Library for Quickbooks Foundation Class for my C++ Builder Program (Using 12.2, 32-bit). Now, when I try to compile it, I get one of two errors. If I don't add #include "comdef.h", I get a bunch of missing _bstr_t declarations. If I *do* add "comdef.h", which is something I found recommended when getting the previous error, I get a number of typedef redefinitions (utilcls.h and comdef.h apparently define several types differently) - heres' one: c:\program files (x86)\embarcadero\studio\23.0\include\windows\sdk\comdef.h(836): error E5551: typedef redefinition with different types ('_com_ptr_t<_com_IIID<IDispatch, ((const IID *)0)> >' vs 'TComInterface< ::IDispatch, &IID_IDispatch>' (aka 'TComInterface<IDispatch, &IID_IDispatch>')) c:\program files (x86)\embarcadero\studio\23.0\include\windows\rtl\utilcls.h(2807): error E67: previous definition is here If I instead add #include "comutil.h", all the errors go away until linking, where I get: [ilink32 Error] Error: Unresolved external '__stdcall _com_issue_error(long)' referenced from C:\USR\SRC\NGB\PROIMPORT\WIN32\DEBUG\QUICKBOOKSTEST.OBJ all references to this particular unresolved external I've found online suggest adding "#include "comdef.h", which results in the *second* error up above. Maybe I can just add a #pragma link "xxxx"? What's the "xxxx" here? Thanks in advance, I. Share this post Link to post
w0wbagger 3 Posted 21 hours ago Well, found this in utilcls.h, so I defined USING_COM_SMARTPTR, and it removed the name clashes, but even after including comdef.h, it can't find the function. Any ideas? #if defined(_INC_COMDEF) || defined(USING_COM_SMARTPTR) /* If someone wants to use definitions from COMDEF.H and UTILCLS.H, the following makes sure that the common typenames do not conflict. Define USING_COM_SMARTPTR if you have to include COMDEF.H after UTILCLS.H WARNING ======= In order to avoid name clashes (unfortunately none of these types are namespaced), we'll rename the types in UTILCLS.H to contain an '_' suffix. EXAMPLE ======= The following allows you to use both IDispatchPtr from COMDEF.H and IDispatchPtr from UTILCLS.H. IDispatchPtr msDispatch; _com_ptr version defined in COMDEF.H IDispatchPtr_ bDispatch; TCOMInterface version in UTILCLS.H */ #pragma message "Typenames collision with COMDEF.H (WARNING) " #define IDispatchPtr IDispatchPtr_ #define IUnknownPtr IUnknownPtr_ #define IFontPtr IFontPtr_ #define IFontDispPtr IFontDispPtr_ #define IPicturePtr IPicturePtr_ #define IPictureDispPtr IPictureDispPtr_ #define IEnumVARIANTPtr IEnumVARIANTPtr_ #endif Share this post Link to post
w0wbagger 3 Posted 18 hours ago I just made my own __stdcall _com_issue_error(long), and it seemed to work. Now I just need to figure out why CreateInstance is failing for QBSessionManager. Share this post Link to post