visual c++ - Warning C4278: 'GetCurrentDirectory': identifier in type library 'GCRComp.tlb' is already a macro; use the 'rename' qualifier -


i'm migrating vc++ 6.0 application visual studio 2008. i've fixed migration errors, i'm fixing warnings. following warning occurs in 40 instances, after trial , errors , research in google, i'm not able fix warning.

please find below instance of c42778 error, if fix 1 below, i'll follow same approach fix remaning 39 warnings.

warning c4278: 'getcurrentdirectory': identifier in type library 'gcrcomp.tlb' macro; use 'rename' qualifier

------code snippet zipfile1.h -------  #import "gcrcomp.tlb" rename_namespace("gcrtools") // c42778   ------code snippet gcrcomp.tlh -------  virtual hresult __stdcall raw_getcurrentdirectory { /*[out]*/ bstr * dirname, /*[out, retval]*/ variant_bool * okstatus)=0; virtual hresult __stdcall get_currentdirectory { /*[out, retval]*/ bstr * pval)=0;   __declspec(property(get=getcurrentdirectory)) _bstr_t currentdirectory;   variant_bool getcurrentdirectory ( bstr * dirname); _bstr_t getcurrentdirectory ();  ------code snippet gcrcomp.tli-------  inline variant_bool iftp1::getcurrentdirectory(bstr * dirname){     variant_bool _result = 0;     hresult _hr = raw_getcurrentdirectory(dirname, &_result);     if(failed(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));     return _result; }  inline _bstr_t iftp1::getcurrentdirectory(){     bstr _result = 0;     hresult _hr = get_currentdirectory(&_result);     if (failed(_hr) _com_issue_errorex(_hr, this, __uuidof(this));     return _bstr_t(result, false); } 

any fix warning appreciated. lot in advance!

it because getcurrentdirectory defined in windows sdk. part of ansi/unicode api conversion. way fix undefined before import gcrcomp.tlb. try this:

#pragma push_macro("getcurrentdirectory") #undef getcurrentdirectory #import "gcrcomp.tlb" rename_namespace("gcrtools") #pragma pop_macro("getcurrentdirectory") 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -