编译时出现提示:Undefined symbol '_variant_t',为何?解决思路

编译时出现提示:Undefined symbol '_variant_t',为何?
用到如下代码,编译时出现提示:Undefined symbol '_variant_t',为何?加入头文件COMUTIL.H,链接时又出现问题
HRESULT GetOptions(IHTMLSelectElement *ppvSelect, BSTR *pszOptText, long *plItems)
{
  IDispatch *ppvdispOption;
  IHTMLOptionElement *ppvOption;
  HRESULT hResult;
 
  // Obtain the number of option objects in the select object.
  ppvSelect->get_length(plItems);
 
  for (long i=0;i<*plItems;i++){
 
  // Get an IDispatch interface for the next option.
  _variant_t index = i;
  hResult = ppvSelect->item( index, index, &ppvdispOption );
  if FAILED(hResult) return(hResult);
 
  // Query for the IHTMLOptionElement interface.
  hResult = ppvdispOption->QueryInterface( IID_IHTMLOptionElement, 
  (void **) &ppvOption);
  ppvdispOption->Release();
  if FAILED(hResult) return(hResult);
 
  // Add the option text to a list box.
  hResult = ppvOption->get_text(&(pszOptText[i]));
  ppvOption->Release();
  if FAILED(hResult) return(hResult);
  }
  return S_OK;
}


------解决方案--------------------
你的用法不对,改成:
C/C++ code
VARIANT index;
index.vt = VT_I4;
index.intVal = i;