By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,375 Members | 1,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,375 IT Pros & Developers. It's quick & easy.

importing a tlb in Visual Studio 2005

P: n/a
I am trying to import a tlb from a COM server(exe) I wrote with the
following statement:

#import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax .tlb"
no_namespace auto_search

the tlh and tli are generated in the debug directory but I get the
following error:

Error 1 error LNK2019: unresolved external symbol "long __cdecl
_com_dispatch_method(struct IDispatch *,long,unsigned short,unsigned
short,void *,wchar_t const *,...)" (?
_com_dispatch_method@@YAJPAUIDispatch@@JGGPAXPB_WZ Z) referenced in
function "public: short __thiscall IUMOSEFax::AddFile(class
_bstr_t)" (?AddFile@IUMOSEFax@@QAEFV_bstr_t@@@Z) command.obj

Is there some linker setting I am missing here? The DLL I am trying
to compile is unmanaged.

Jun 15 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
ku************@gmail.com wrote:
I am trying to import a tlb from a COM server(exe) I wrote with the
following statement:

#import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax .tlb"
no_namespace auto_search

the tlh and tli are generated in the debug directory but I get the
following error:

Error 1 error LNK2019: unresolved external symbol "long __cdecl
_com_dispatch_method(struct IDispatch *,long,unsigned short,unsigned
short,void *,wchar_t const *,...)" (?
_com_dispatch_method@@YAJPAUIDispatch@@JGGPAXPB_WZ Z) referenced in
function "public: short __thiscall IUMOSEFax::AddFile(class
_bstr_t)" (?AddFile@IUMOSEFax@@QAEFV_bstr_t@@@Z) command.obj

Is there some linker setting I am missing here? The DLL I am trying
to compile is unmanaged.
It looks like you're missing comsupp.lib from your linker inputs, or
possibly your library path is incorrect so the linker is finding an
incorrect version. I believe that the compiler-generated files
automatically reference the correct library (there are actually 4 different
libraries), so I'd lean towards the lib path being off. Try adding /verbose
to your linker settings to see where (or if!) the linker is finding
comsupp[w][d].lib.

-cd
Jun 15 '07 #2

P: n/a
Jun 15 '07 #3

P: n/a
On Jun 15, 8:19 am, kurt.kurtsm...@gmail.com wrote:
On Jun 15, 7:03 am, "Carl Daniel [VC++ MVP]"

<cpdaniel_remove_this_and_nos...@mvps.org.nospamwr ote:
kurt.kurtsm...@gmail.com wrote:
I am trying to import a tlb from a COM server(exe) I wrote with the
following statement:
#import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax .tlb"
no_namespace auto_search
the tlh and tli are generated in the debug directory but I get the
following error:
Error 1 error LNK2019: unresolved external symbol "long __cdecl
_com_dispatch_method(struct IDispatch *,long,unsigned short,unsigned
short,void *,wchar_t const *,...)" (?
_com_dispatch_method@@YAJPAUIDispatch@@JGGPAXPB_WZ Z) referenced in
function "public: short __thiscall IUMOSEFax::AddFile(class
_bstr_t)" (?AddFile@IUMOSEFax@@QAEFV_bstr_t@@@Z) command.obj
Is there some linker setting I am missing here? The DLL I am trying
to compile is unmanaged.
It looks like you're missing comsupp.lib from your linker inputs, or
possibly your library path is incorrect so the linker is finding an
incorrect version. I believe that the compiler-generated files
automatically reference the correct library (there are actually 4 different
libraries), so I'd lean towards the lib path being off. Try adding /verbose
to your linker settings to see where (or if!) the linker is finding
comsupp[w][d].lib.
-cd- Hide quoted text -
- Show quoted text -

Here is the verbose output. I am assuming it is finding the right
comsupp.lib as it finds the 8.0 version?

------ Rebuild All started: Project: UMOSEFaxPrint, Configuration:
Debug Win32 ------
Deleting intermediate and output files for project 'UMOSEFaxPrint',
configuration 'Debug|Win32'
Compiling...
ddihook.cpp
debug.cpp
devmode.cpp
dllentry.cpp
enable.cpp
intrface.cpp
Generating Code...
Compiling...
command.cpp
c:\em2\em\src\core\umosefaxprint\command.cpp(255) : warning C4101:
'pDispatch' : unreferenced local variable
c:\em2\em\src\core\umosefaxprint\command.cpp(254) : warning C4101:
'ppvObj' : unreferenced local variable
c:\em2\em\src\core\umosefaxprint\command.cpp(253) : warning C4101:
'm_dwActiveACDID' : unreferenced local variable
Compiling resources...
Compiling manifest to resources...
Linking...
Starting pass 1
Processed /DEFAULTLIB:uuid.lib
Processed /DEFAULTLIB:comsupp.lib
Processed /DEFAULTLIB:user32.lib
Processed /DEFAULTLIB:ole32.lib
Processed /DEFAULTLIB:oleaut32.lib
Processed /DEFAULTLIB:LIBCMTD
Processed /DEFAULTLIB:OLDNAMES
Searching libraries
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB
\comsupp.lib:
Found "void __stdcall _com_issue_error(long)" (?
_com_issue_error@@YGXJ@Z)
Referenced in command.obj
Loaded comsupp.lib(comsupp.obj)
Found "void __stdcall _com_raise_error(long,struct IErrorInfo
*)" (?_com_raise_error@@YGXJPAUIErrorInfo@@@Z)
Referenced in comsupp.lib(comsupp.obj)
Loaded comsupp.lib(comraise.obj)
Found "long __cdecl _com_invoke_helper(struct IDispatch
*,long,unsigned short,unsigned short,void *,unsigned short const
*,char *,struct IErrorInfo * *)" (?
_com_invoke_helper@@YAJPAUIDispatch@@JGGPAXPBGPADP APAUIErrorInfo@@@Z)
Referenced in comsupp.lib(comsupp.obj)
Loaded comsupp.lib(invkprxy.obj)
Found "long __stdcall _com_handle_excepinfo(struct tagEXCEPINFO
&,struct IErrorInfo * *)" (?
_com_handle_excepinfo@@YGJAAUtagEXCEPINFO@@PAPAUIE rrorInfo@@@Z)
Referenced in comsupp.lib(invkprxy.obj)
Loaded comsupp.lib(invkerr.obj)
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB
\kernel32.lib:
Found __imp__DebugBreak@0
Referenced in command.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__CreateFileW@28
Referenced in command.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__GetTempFileNameW@16
Referenced in command.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__GetTempPathW@8
Referenced in command.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__InterlockedDecrement@4
Referenced in command.obj
Referenced in intrface.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__OutputDebugStringA@4
Referenced in debug.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__OutputDebugStringW@4
Referenced in debug.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__SetLastError@4
Referenced in devmode.obj
Referenced in intrface.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__InterlockedIncrement@4
Referenced in intrface.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__CloseHandle@4
Referenced in intrface.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__GetLastError@0
Referenced in intrface.obj
Referenced in comsupp.lib(invkprxy.obj)
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__WriteFile@20
Referenced in intrface.obj
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__LocalFree@4
Referenced in comsupp.lib(comraise.obj)
Loaded kernel32.lib(KERNEL32.dll)
Found __imp__lstrlenW@4
Referenced in comsupp.lib(invkprxy.obj)
Loaded kernel32.lib(KERNEL32.dll)
Found __IMPORT_DESCRIPTOR_KERNEL32
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Referenced in kernel32.lib(KERNEL32.dll)
Loaded kernel32.lib(KERNEL32.dll)
Found __NULL_IMPORT_DESCRIPTOR
Referenced in kernel32.lib(KERNEL32.dll)
Loaded kernel32.lib(KERNEL32.dll)
Found KERNEL32_NULL_THUNK_DATA
Referenced in kernel32.lib(KERNEL32.dll)
Loaded kernel32.lib(KERNEL32.dll)
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\ole32.lib:
Found __imp__CoUninitialize@0
Referenced in command.obj
Loaded ole32.lib(ole32.dll)
Found __imp__CoGetClassObject@20
Referenced in command.obj
Loaded ole32.lib(ole32.dll)
Found __imp__CLSIDFromProgID@8
Referenced in command.obj
Loaded ole32.lib(ole32.dll)
Found __imp__CoInitialize@4
Referenced in command.obj
Loaded ole32.lib(ole32.dll)
Found __imp__StringFromGUID2@12
Referenced in intrface.obj
Loaded ole32.lib(ole32.dll)
Found __IMPORT_DESCRIPTOR_ole32
Referenced in ole32.lib(ole32.dll)
Referenced in ole32.lib(ole32.dll)
Referenced in ole32.lib(ole32.dll)
Referenced in ole32.lib(ole32.dll)
Referenced in ole32.lib(ole32.dll)
Loaded ole32.lib(ole32.dll)
Found ole32_NULL_THUNK_DATA
Referenced in ole32.lib(ole32.dll)
Loaded ole32.lib(ole32.dll)
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
\lib\oleaut32.lib:
Found __imp__SysAllocString@4
Referenced in command.obj
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__SysFreeString@4
Referenced in command.obj
Referenced in comsupp.lib(invkerr.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__GetErrorInfo@8
Referenced in comsupp.lib(comsupp.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__VariantChangeType@16
Referenced in comsupp.lib(invkprxy.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__VariantClear@4
Referenced in comsupp.lib(invkprxy.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__VariantInit@4
Referenced in comsupp.lib(invkprxy.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__SetErrorInfo@8
Referenced in comsupp.lib(invkprxy.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __imp__CreateErrorInfo@4
Referenced in comsupp.lib(invkerr.obj)
Loaded oleaut32.lib(OLEAUT32.dll)
Found __IMPORT_DESCRIPTOR_OLEAUT32
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Referenced in oleaut32.lib(OLEAUT32.dll)
Loaded oleaut32.lib(OLEAUT32.dll)
Found OLEAUT32_NULL_THUNK_DATA
Referenced in oleaut32.lib(OLEAUT32.dll)
Loaded oleaut32.lib(OLEAUT32.dll)
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB
\uuid.lib:
Found _IID_IDispatch
Referenced in command.obj
Loaded uuid.lib(oaidl_i.obj)
Found _IID_IClassFactory
Referenced in command.obj
Referenced in intrface.obj
Loaded uuid.lib(unknwn_i.obj)
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
...

read more - Hide quoted text -

- Show quoted text -
I am a moron. I just realized I was not linking against the wide
version.

Sorry for wasting your time.
Jun 15 '07 #4

P: n/a
<ku************@gmail.comwrote in message
I just realized I was not linking against the wide version.

Sorry for wasting your time.
Not a problem - we've all been there :)

-cd


Jun 15 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.