Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#include <comutil.h> cause errors

Tags:

VS 2010 C++ CLR Library project, errors on adding comutil.h library

> Error 20  error LNK2001: unresolved > external symbol "extern "C" long > __stdcall VariantCopy(struct tagVARIANT *,struct tagVARIANT const > *)" (?VariantCopy@@$$J18YGJPAUtagVARIANT@@PBU1@@Z)    D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 18  error LNK2001: unresolved > external symbol "extern "C" void > __stdcall VariantInit(struct tagVARIANT *)" > (?VariantInit@@$$J14YGXPAUtagVARIANT@@@Z) D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 13  error LNK2001: unresolved > external symbol "void __stdcall > _com_issue_error(long)" (?_com_issue_error@@$$FYGXJ@Z)    D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 10  error LNK2028: unresolved > token (0A000376) "void __stdcall > _com_issue_error(long)" (?_com_issue_error@@$$FYGXJ@Z) > referenced in function "void __cdecl > _com_util::CheckError(long)" (?CheckError@_com_util@@$$FYAXJ@Z)   D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 4   error LNK2028: unresolved > token (0A0003BC) "extern "C" void > __stdcall VariantInit(struct tagVARIANT *)" > (?VariantInit@@$$J14YGXPAUtagVARIANT@@@Z) > referenced in function "public: > __thiscall _variant_t::_variant_t(class _variant_t const &)" (??0_variant_t@@$$FQAE@ABV0@@Z)  D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 2   error LNK2028: unresolved > token (0A0003D1) "extern "C" long > __stdcall VariantCopy(struct tagVARIANT *,struct tagVARIANT const > *)" (?VariantCopy@@$$J18YGJPAUtagVARIANT@@PBU1@@Z) > referenced in function "public: > __thiscall _variant_t::_variant_t(class _variant_t const &)" (??0_variant_t@@$$FQAE@ABV0@@Z)  D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET 

needed for

private:         std::string from_variant(VARIANT& vt)         {             _bstr_t bs(vt);             return std::string(static_cast<const char*>(bs));         }         /*         void to_variant(const std::string& str, VARIANT& vt)         {             _bstr_t bs(str.c_str());             reinterpret_cast<_variant_t&>(vt) = bs;         }*/ 

how can I fix it ?

like image 947
cnd Avatar asked Dec 07 '10 09:12

cnd


1 Answers

try to include comdef.h, don't include comutil.h

like image 166
zhen ma Avatar answered Sep 28 '22 09:09

zhen ma