本文介绍了解决错误->错误LNK2020:未解析的令牌(0A000010)IID_IStorage和BackGUI.obj:错误LNK2001:未解析的外部符号IID_IStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
在我的"Windows窗体应用程序"项目中,我创建了Button.在按钮"上单击,我想使用函数StgOpenStorageEx()打开硬盘上存在的复合文件.我在按钮单击事件中为此编写的代码为

Hello,
In my "Windows Form Application" project, i have created Button. On Button click , I want to open compound file present on my hard disk using function StgOpenStorageEx(). the code i have written code for this in button click event as

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
            IStorage    *pStorage;               if(StgOpenStorageEx(L"E:\\Backup.stg",STGM_READ|STGM_SHARE_DENY_WRITE,STGFMT_DOCFILE,0, NULL, 0,IID_IStorage,(void**)&pStorage)==S_OK)
            {
                tb4->Text="hehe";
            }
         }



为此,我添加了诸如
的头文件



for this i have added header files like

#include "StdAfx.h"
#include<Objbase.h>


另外,我在proj-> properties-> Linker-> input->其他依赖项中添加了"Ole32.lib".
但是我仍然在追随错误


Also I have added "Ole32.lib" in proj->properties->Linker->input->additional dependencies.
But still im getting following errors

1>BackGUI.obj : error LNK2020: unresolved token (0A000010) IID_IStorage
1>BackGUI.obj : error LNK2001: unresolved external symbol IID_IStorage
1>C:\Users\SUMIT\Desktop\prj\BACKUP & RESTORE\BackGUI\Debug\BackGUI.exe : fatal error LNK1120: 2 unresolved externals



任何建议plz ??



any suggestions plz??

推荐答案

#ifndef IID_IStorage
#define IID_IStorage "0000000B-0000-0000-C000-000000000046"
#endif



在这里,您可以看到有人在其代码中定义的位置(使用DEFINE_GUID()宏):
http://express-os.googlecode.com/svn-history/r51/express-os/bin/sh.cpp [ ^ ]

...还有另一篇参考资料:
http://force7.de/nimrod/ole2.html#119 [ ^ ]



Here you can see where someone defined that in their code (using DEFINE_GUID() macro):
http://express-os.googlecode.com/svn-history/r51/express-os/bin/sh.cpp[^]

...and yet another reference:
http://force7.de/nimrod/ole2.html#119[^]


这篇关于解决错误->错误LNK2020:未解析的令牌(0A000010)IID_IStorage和BackGUI.obj:错误LNK2001:未解析的外部符号IID_IStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 23:42