使用IMAPI,CoCreateInstance时,编译link出错

浅蓝马 2006-02-13 08:42:40
我在用IMAPI来写刻录的程序,包括<imapi.h>后,用以下的代码编译时,link时出错。

IDiscMaster* pDiskMaster = NULL;
hr = CoCreateInstance(CLSID_MSDiscMasterObj, NULL, CLSCTX_LOCAL_SERVER,
IID_IDiscMaster, (void**)&pDiskMaster);

option设定如下,(include):
C:\Program Files\Microsoft Platform SDK\Include
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE

(lib)设定如下时
C:\Program Files\Microsoft Visual Studio\VC98\LIB
C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB
C:\Program Files\Microsoft Platform SDK\Lib
link错误是:error LNK2001,外部符号_CLSID_MSDiscMasterObj和_IID_IDiscMaster未解决。


(lib)设定如下时
C:\Program Files\Microsoft Platform SDK\Lib
C:\Program Files\Microsoft Visual Studio\VC98\LIB
C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB
link错误是:fatal error LNK1103,debug信息损坏,让再进行编译。

以上的link错误,在project的设定中,link页面设定uuid.lib,或者不设定uuid.lib,都是一样。

哪位知道是怎么回事?请帮帮忙。谢谢。
...全文
151 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
bob98 2006-04-07
  • 打赏
  • 举报
回复
这个问题我也遇到了,用vc7就不会有问题了
蒋晟 2006-02-14
  • 打赏
  • 举报
回复
put
#define NTDDI_VERSION NTDDI_WINXP
before including window sheader files, and link to uuid.lib

see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp

reference
http://msdn.microsoft.com/library/en-us/vccore/html/LNK2005.asp

rageliu 2006-02-14
  • 打赏
  • 举报
回复
1. 确定_CLSID_MSDiscMasterObj和_IID_IDiscMaster有值,用倒之的方法或包含对应的.h文件
2. 看看msdn里面对lib文件的要求,没有就加上
wangk 2006-02-14
  • 打赏
  • 举报
回复
例:
const GUID IID_IDiscMaster = {0x520CCA62,0x51A5,0x11D3,0x91,0x44,0x00,0x10,0x4b,0xa1,0x1c,0x5e}; //uuid(520CCA62-51A5-11D3-9144-00104BA11C5E)
IDiscMaster* pDiskMaster = NULL;
CoCreateInstance(__uuidof(MSDiscMasterObj), NULL, CLSCTX_LOCAL_SERVER,
IID_IDiscMaster, (void**)&pDiskMaster);
wangk 2006-02-14
  • 打赏
  • 举报
回复
const GUID IID_IDiscMaster = {0x520CCA62,0x51A5,0x11D3,0x91,0x44,0x00,0x10,0x4b,0xa1,0x1c,0x5e}; //uuid(520CCA62-51A5-11D3-9144-00104BA11C5E)

就可以用了,uuid值在MSDN中有说明。

或者下载最新的SDK。
浅蓝马 2006-02-14
  • 打赏
  • 举报
回复
不行,重装过了platform sdk,还是一样。有谁有imapi的例程么?
浅蓝马 2006-02-14
  • 打赏
  • 举报
回复
需要再装一下 platform SDK么?我试试吧。
还有其他人有方法么?
蒋晟 2006-02-14
  • 打赏
  • 举报
回复
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
This is the last version of Microsoft Platform SDK compatible with Visual C++ 6.0

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧