tags:

views:

27

answers:

1

Hello All,

I want to static link mapi32.lib with my vc++ project in vs.net2005 project. I am using the following import statement inside my testdll.cpp project which is my entry point of the application.

#import "mapi32.lib" 

I have put references for C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib path inside c/c++ -> general section and Linker->general section of the project.And also add reference in properties -> debug source files section as well.

But after doing all this I am getting the following error, please help

Error 3 fatal error C1083: Cannot open type library file: 'c:\program files\microsoft visual studio 8\vc\platformsdk\lib\mapi32.lib': Error loading type library/DLL. c:\TestDll\TestDll\TestDll\TestDll.cpp 14

Regards,

A: 

To statically link with mapi.lib, you need to tell the linker about it. The best way to do this is in your project settings. Go to Linker -> Input and add the mapi32.lib to the Additional Dependencies field. You sould do this step for all your project configurations.

To refer to the lib within your code, of course you have to include the appropriate header files.

The #import "mapi32.lib" statement is usually used to import COM object type libraries and has nothing to do with static linking. So you should remove that line.

Good luck.

Frank Bollack