开发者

error C2065: undeclared identifier

开发者 https://www.devze.com 2022-12-29 05:29 出处:网络
Currently, I have this function inside my other cpp file: UINT32 functionHtml(const wchar_t *url) { WinHttpClient client(url);

Currently, I have this function inside my other cpp file:

  UINT32 functionHtml(const wchar_t *url)
  {
     WinHttpClient client(url);
     client.SendHttpRequest();
     wstring httpResponseHeader = client.GetHttpResponseHeader();
     wstring httpResponse = client.GetHttpResponse();     
     writeToLog(httpResponse.c_str());

     return 0;
  }

I have another cpp file, and I would like to execute the stuff inside the above file. Here is the code for the other file:

HRESULT CButtonDemoBHO::onDocumentComplete(IDispatch *pDisp, VARIANT *vUrl){
ATLTRACE("CButtonDemoBHO::onDocumentComplete %S\n", vUrl->bstrVal);

//  <---- i would like to call funtionHTML here or ..

if (isMainFrame(pDisp)){
    m_normalPageLoad=false;

//  <---- here..

  MessageBox(m_hWnd, L"Main Document has completed loading", L"Document Complete", MB_OK);

  return S_OK;
 }
 return S_OK;

}

开发者_Python百科I got the error C2065: 'url' : undeclared identifier. Need help.


You are going to need to convert vUrl from VARIANT* (not familiar with that type) to an object of type const wchar_t*, and invoke functionHtml on that resulting object. The reason you got an "undeclared identifier" error is that you attempted to invoke functionHtml(url), despite the fact that there is no variable named url in the scope in which you are attempting to make that invocation; you need to create your own variable of type const wchar_t* to use as a parameter to functionHtml().

0

精彩评论

暂无评论...
验证码 换一张
取 消