错误LNK2020:未解析的令牌(0A000017)IID_IStorage和错误LNK2001:未解析的外部符号IID_IStorage [英] error LNK2020: unresolved token (0A000017) IID_IStorage and error LNK2001: unresolved external symbol IID_IStorage
问题描述
你好,
首先,我使用StgCreateDocfile()创建了一个存储文件,然后在其中添加了一些文件.然后我尝试使用
打开此存储文件
Hello,
First, I created a storage file using StgCreateDocfile() then added some files in it. Then i tried to open this storage file using
hr = StgOpenStorageEx(L"E:\\Storage.stg",STGM_READ|STGM_SHARE_DENY_WRITE,STGFMT_DOCFILE,0, NULL, 0,IID_IStorage,(void**)&pStorage);
当我执行win32控制台应用程序时,它的效果很好.
但是,当我尝试将其添加到Windows窗体应用程序项目中的相同代码,将c ++类添加到项目中,然后将我的代码添加到该类时,它会生成运行时错误
which worked fine when i did it win32 console application.
But when i tried it add the same code in Windows form application project, adding a c++ class to project and then my code to that class, it generate a runtime error
1>Recovery.obj : error LNK2020: unresolved token (0A000017) IID_IStorage
1>Recovery.obj : error LNK2001: unresolved external symbol IID_IStorage
新创建的类中的IID_IStorage有什么问题?
我需要在项目设置中对链接器属性做些事情吗?
whats the problem with IID_IStorage in newly created class.
Do i need to do something with Linker properties in project setting?
推荐答案
似乎您缺少一个lib文件.尝试将 Uuid.lib 添加到链接器库中.
It seems you are missing a lib file. Try adding Uuid.lib to your linker libraries.
我认为您可能需要在源代码中包含Objidl.h
,如 ^ ].
I think you may need to include Objidl.h
in your source code as described here[^] in MSDN.
这篇关于错误LNK2020:未解析的令牌(0A000017)IID_IStorage和错误LNK2001:未解析的外部符号IID_IStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!