描述:
atl程序编译成功后
Performing registration
Server registration done!
客户是个mfc程序
头文件加进来了
调用时
HRESULT hr;
ISimpleInterface * pIntf = NULL;
hr = CoCreateInstance
(CLSID_SimpleInterface, NULL, CLSCTX_SERVER ,
IID_ISimpleInterface, (void **)& pIntf);
if(SUCCEEDED(hr))
{
pIntf->Welcome();
pIntf->Release();
}
结果是联结错误!
UsingAtlDlg.obj : error LNK2001: unresolved external symbol _CLSID_SimpleInterface
UsingAtlDlg.obj : error LNK2001: unresolved external symbol _IID_ISimpleInterface
还有什么没有做???
解决方案1:
1.
CLSID_SimpleInterface -> __uuidof(CLSID_SimpleInterface)
IID_ISimpleInterface -> __uuidof(IID_ISimpleInterface)
or
2. ****_i.c to stdafx.cpp
还有一个 ****_i.c的文件,注意包含进去
解决方案3: 查看 -〉 建立类向导 -〉 Add Class(按钮) -〉From a type library
找到你的 *.tlb,就好了
CLSID_SimpleInterface和IID_ISimpleInterface没找到,还是少了这两个东东的导入头文件了吧?