Article ID: 191626 - Last Review: February 24, 2004 - Revision: 3.0 FIX: CComVariant > and < Operators Cause LNK2001 ErrorsThis article was previously published under Q191626 SYMPTOMS
If you use the "greater than" (>) or "less than" (<) comparison operators for CComVariant, you receive the following linker error:
error LNK2001: unresolved external symbol _VarCmp@12
CAUSE
You use VarCmp() to compare two VARIANTS. This function is supposed to
take four arguments. The declaration for VarCmp() in Oleauto.h is
incorrect, and it takes only three arguments. ATL also calls VarCmp()
incorrectly with three arguments in CComVariant::operator < and
CComVariant::operator >.
RESOLUTION
In OLEAUTO.H, change the declaration for VarCmp() from:
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base: 194022 (http://support.microsoft.com/kb/194022/EN-US/ ) INFO: Visual Studio 6.0 Service Packs, What, Where, Why 194295 (http://support.microsoft.com/kb/194295/EN-US/ ) HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed MORE INFORMATION
VarCmp() is implemented only in a newer version of Oleaut32.dll (2.30.4261
or later). If you use the CComVariant > or < operators, you must distribute Oleaut32.dll via Vbrun60.exe. For more information, refer to Redist.wri in the VC98\Redist directory on the Visual C++ CD.
| Article Translations
|
Back to the top
