积极答复者
Metro C++编译出错,请大家帮忙看看。

问题
-
出错代码如下:
bool CImap::ConnectServer() { ImapClient=ref new StreamSocket(); task<void> (ImapClient->ConnectAsync(hostname,port)).then([this] (task<void> pretask) { try{ pretask.get(); } catch (Exception^ ex) { ; } }); dr=ref new DataReader(ImapClient->InputStream); task<void> (dr->LoadAsync(4)).then([this] (task<void> pretask2) { try{ pretask2.get(); } catch (Exception^ ex) { ; } }); test=ref new String(); test=dr->ReadString(dr->UnconsumedBufferLength); }
错误提示如下:
答案
-
task<unsigned int> (dr->LoadAsync(4)).then([this] (task<void> pretask2)
...LoadAsync 返回 DataReaderLoadOperation 并不是一个无参的AsyncAction,而是实现
IAsyncOperation<unsigned int>
的,所以我们需要用 task<unsigned int> 去接
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已编辑 Jie BaoModerator 2012年8月28日 8:16
- 已标记为答案 清风梧桐 2012年8月29日 2:49
全部回复
-
task<unsigned int> (dr->LoadAsync(4)).then([this] (task<void> pretask2)
...LoadAsync 返回 DataReaderLoadOperation 并不是一个无参的AsyncAction,而是实现
IAsyncOperation<unsigned int>
的,所以我们需要用 task<unsigned int> 去接
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已编辑 Jie BaoModerator 2012年8月28日 8:16
- 已标记为答案 清风梧桐 2012年8月29日 2:49