FIX: LNK1152 & LNK1141 When Linking OLE Control to Mapi32.lib
This article was previously published under Q141485 On This PageSYMPTOMS
Attempting to link an OLE Control project with Mapi32.lib results in the
following warnings and errors:
warning LNK4022: cannot find unique match for symbol "DllCanUnloadNow"
warning LNK4002: _DllCanUnloadNow defined in C:\MSDEV\LIB\MAPI32.LIB
warning LNK4002: _DllCanUnloadNow@0 defined in
C:\MSDEV\MFC\lib\mfcs40d.lib
warning LNK4002: _DllCanUnloadNow@0 defined in
C:\MSDEV\LIB\oleaut32.lib
warning LNK4022: cannot find unique match for symbol
"DllGetClassObject"
warning LNK4002: _DllGetClassObject defined in C:\MSDEV\LIB\MAPI32.LIB
warning LNK4002: _DllGetClassObject@12 defined in
C:\MSDEV\MFC\lib\mfcs40d.lib
warning LNK4002: _DllGetClassObject@12 defined in
C:\MSDEV\LIB\oleaut32.lib
fatal error LNK1152: cannot resolve one or more undecorated symbols
fatal error LNK1141: failure during build of exports file
CAUSE
The import library for the Mapi32.dll (Mapi32.lib) incorrectly exports the
DllCanUnloadNow and DllGetClassObject functions. These functions should be
exported privately and not included in the import library.
RESOLUTION
To work around this problem, build the Mapi32.lib import library from
scratch by using the Lib.exe utility included with Visual C++ 4.0.
Copy the sample code listed below into a text file, and save it as Mapi32.def. From the command prompt, enter the following command line to execute the Lib.exe utility and build a new Mapi32.lib import library:
LIB /DEF:MAPI32.DEF
Replace the incorrect Mapi32.lib file located in the ~\Msdev\Lib directory
with this newly created Mapi32.lib file, and rebuild the OLE Control
project.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products
listed at the beginning of this article. This bug was corrected in
Visual C++ 4.1.
MORE INFORMATION
For additional information on how to build import libraries without access
to source files, please refer to the following article in the Microsoft
Knowledge Base:
131313 (http://support.microsoft.com/kb/131313/EN-US/)
How to Create 32-bit Import Libraries Without .OBJs or Source
Sample Code
| Article Translations
|
Back to the top
