title: co_await expression needs await_ready function
body: <p>I have a Win32 programm, where I want to add some winRT calls. Among other things I want to open a file without a GUI interface. </p>
  
  <p>I use the async file open call from the StorageFile class, because the next call needs an IStorageFile interface.  </p>
  
  <pre><code>#include &lt;roapi.h&gt;
  #include &lt;winrt/Windows.Storage.h&gt; 
  #include &lt;winrt/Windows.Foundation.h&gt;
  
  void openFile()
  {
     using namespace winrt;
     using namespace winrt::Windows::Foundation;
     using namespace winrt::Windows::Storage;
  
     HRESULT rtn = RoInitialize(RO_INIT_MULTITHREADED); 
     winrt::hstring path{ L"C:\\Users...\\mytextfile.txt"};
  
     //wait for open the file 
     auto file = co_await StorageFile::GetFileFromPathAsync(path);
  
     //IStorageFile interface needed  
  }
  
  int main()
  {
    openFile(); 
    return 0;
  }
  </code></pre>
  
  <p>At the moment, the compiler complains that the co_await expression requires a suitable "await_ready" function and none was found. </p>
  
  <p>I`m not sure if this is the case due to a missing header include or if "co_await" can not be used within a win32 application.  </p>
  
  <p>Edit:
  My visual studio project setup is: 
  - use c++17, add cppwinrt.exe to my include directories, link against windowsapp.lib and use windows sdk version 10.0.17134.0. </p>