解决错误->错误LNK2020:未解析的令牌(0A000010)IID_IStorage和BackGUI.obj:错误LNK2001:未解析的外部符号IID_IStorage [英] Resolving Errors-> error LNK2020: unresolved token (0A000010) IID_IStorage and BackGUI.obj : error LNK2001: unresolved external symbol IID_IStorage

查看:153
本文介绍了解决错误->错误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??

推荐答案

(如果您在此处查看):
http://msdn.microsoft.com/en-us/library/aa380015% 28VS.85%29.aspx [ ^ ]

...它说"IID_IStorage被定义为0000000B-0000-0000-C000-000000000046",所以为什么不尝试自己定义它,它可能是在您忘记包含的地方定义的,或者您必须自己定义使用它.

因此,请尝试此操作(尽管查看其他一些引用,但您可能需要使用DEFINE_GUID()宏,因为它的数量很大而不是文本)...
if you look here:
http://msdn.microsoft.com/en-us/library/aa380015%28VS.85%29.aspx[^]

...it says "IID_IStorage is defined as 0000000B-0000-0000-C000-000000000046", so why don''t you try to define it yourself, its probably defined somewhere that you forgot to include or you have to define it yourself to use it.

So try this (although looking at some of the other references, you probably need to use the DEFINE_GUID() macro since its a large number rather than text)...
#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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆