错误为:
error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)" (?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function "public: char const * __thiscall _bstr_t::Data_t::GetString(void)const " (?GetString@Data_t@_bstr_t@@QBEPBDXZ)
Debug/ana.exe : fatal error LNK1120: 1 unresolved externals我已经  #include <comutil.h>
        #pragma comment(lib, "comsupp.lib")为什么会出现链接错误?出错语句为  CString str1=(char*)(_bstr_t)pvv[0][0];其中pvv为 vector<vector<VARIANT> > pvv  是从EXCEL读取的表。是不是与vector有冲突?

解决方案 »

  1.   

    如果是用vc7.0以上版本编译,在工程属性里面把C/C++->语言中的“将 wchar_t 视为内置类型”改成“否”。如果是vc6.0,MSDN里面讲到过这个问题(以前看到过,忘了内容了),搜索一下。
      

  2.   

    _variant_t LastTime;
    try
    {
    char buf[400];
    m_pRecordset.CreateInstance("ADODB.Recordset");
    sprintf(buf,"select * from lasttime");
    m_pRecordset->Open(_variant_t(buf),theApp.m_pConnect.GetInterfacePtr(),adOpenStatic,adLockOptimistic,adCmdText);

    while (!m_pRecordset->adoEOF)
    {
    LastTime= m_pRecordset->GetCollect("RDATETIME"); m_pRecordset->MoveNext();
    }   
    m_pRecordset->Close();
    }
    catch (_com_error e)
    {
    AfxMessageBox(e.ErrorMessage());
    }
    LastTime.ChangeType(VT_DATE);
    CString strLastTime;
    strLastTime = _com_util::ConvertBSTRToString(_bstr_t(LastTime));
      

  3.   

    按whale()方法已解决,多谢各位解答