Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,
First, I created a storage file using StgCreateDocfile() then added some files in it. Then i tried to open this storage file using

MIDL
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
VB
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
Updated 23-Apr-11 4:09am
v2

It seems you are missing a lib file. Try adding Uuid.lib to your linker libraries.
 
Share this answer
 
Comments
MartinTaylor 23-Apr-11 10:28am    
As you mentioned , i have added Uuid.lib in Properties->linker->Input->additional dependencies..
But i didnt worked....
I think you may need to include Objidl.h in your source code as described here[^] in MSDN.
 
Share this answer
 
Comments
MartinTaylor 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900