Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Visual-Studio
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);
 
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
 
whats the problem with IID_IStorage in newly created class.
 
Do i need to do something with Linker properties in project setting?
Posted 23-Apr-11 4:40am
Edited 23-Apr-11 5:09am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It seems you are missing a lib file. Try adding Uuid.lib to your linker libraries.
  Permalink  
Comments
MartinTaylor at 23-Apr-11 10:28am
   
As you mentioned , i have added Uuid.lib in Properties->linker->Input->additional dependencies..
But i didnt worked....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I think you may need to include Objidl.h in your source code as described here[^] in MSDN.
  Permalink  
Comments
MartinTaylor at 24-Apr-11 3:44am
   
Objidl.h is already added... i wont be getting this error if i would have missed to include Objidl.h...
My problem is :- my code worked fine in windows console application project, but in windows form application as project type, i created a c++ class and added same code in it..but seems to have some problem for IID_IStorage parameter in "StgOpenStorageEx()" function which is leading to LNK 2020 and 2001 error..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 215
1 George Jonsson 175
2 Kornfeld Eliyahu Peter 159
3 PIEBALDconsult 110
4 Richard MacCutchan 85
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 23 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100