-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to build HelloVectors using VS2019 v142 #47
Comments
There was an update to C++/WinRT at some point that made it less aggressive at pulling in headers to make compile times better, but it also means being more explicit about including the right headers. It looks like this sample is experiencing that issue. Here's what I did to get it working on my machine (after upgrading the SDK and toolset like you did):
Let me know if that works for you! If so, I'll try to get a pull request issued for it. |
This is odd, any |
Hi! Is there any progress in this issue? |
Disabling conformance did not seem to work for me. For those who run into this in the future, I got similar error message (just the error regarding #include "winrt/base.h"
namespace winrt::impl
{
template <typename Async>
auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout);
} |
The problem is that \Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt\Windows.Foundation.h is the file that defines winrt::impl::wait_for, but also the one that includes "winrt/impl/Windows.Foundation.2.h" at the beginning, which in turn needs winrt::impl::wait_for. |
For what it's worth, one solution is to simply manually add the latest (Version 2+) Microsoft.Windows.CppWinRT (https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/) package to the project (by default, it's not there). This will modify the .csproj and then everything should compile fine. |
Adding '/Zc:twoPhase-' might also help. |
I've just cloned the repo, opened the HelloVectors solution file and upgraded to SDK 10.0.18362.0 and toolset v142, and attempted to build. I get the following errors:
1>------ Build started: Project: HelloVectors_win32_cpp, Configuration: Debug x64 ------ 1>pch.cpp 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(980,26): error C2039: 'wait_for': is not a member of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(100): message : see declaration of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(982): message : see reference to class template instantiation 'winrt::impl::consume_Windows_Foundation_IAsyncAction<D>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(9818): message : see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IContextCallback>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(9590): message : see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IServerSecurity>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(9549): message : see reference to class template instantiation 'std::chrono::time_point<winrt::clock,winrt::Windows::Foundation::TimeSpan>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(2117): message : see reference to class template instantiation 'winrt::com_ptr<To>' being compiled 1> with 1> [ 1> To=winrt::impl::IStaticLifetimeCollection 1> ] 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(8969): message : see reference to function template instantiation 'winrt::com_ptr<To> winrt::Windows::Foundation::IUnknown::as<winrt::impl::IStaticLifetimeCollection>(void) const' being compiled 1> with 1> [ 1> To=winrt::impl::IStaticLifetimeCollection 1> ] 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(8966): message : see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IStaticLifetime>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(5215): message : see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IMarshal>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(2460): message : see reference to class template instantiation 'winrt::com_ptr<To>' being compiled 1> with 1> [ 1> To=winrt::impl::ILanguageExceptionErrorInfo2 1> ] 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(4097): message : see reference to function template instantiation 'winrt::com_ptr<To> winrt::com_ptr<winrt::impl::IRestrictedErrorInfo>::try_as<winrt::impl::ILanguageExceptionErrorInfo2>(void) noexcept const' being compiled 1> with 1> [ 1> To=winrt::impl::ILanguageExceptionErrorInfo2 1> ] 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\base.h(4179): message : see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IRestrictedErrorInfo>' being compiled 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\xstring(1743): message : see reference to class template instantiation 'std::basic_string_view<wchar_t,std::char_traits<wchar_t>>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(1001,26): error C2039: 'wait_for': is not a member of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(100): message : see declaration of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(1003): message : see reference to class template instantiation 'winrt::impl::consume_Windows_Foundation_IAsyncActionWithProgress<D,TProgress>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(1035,26): error C2039: 'wait_for': is not a member of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(100): message : see declaration of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(1037): message : see reference to class template instantiation 'winrt::impl::consume_Windows_Foundation_IAsyncOperationWithProgress<D,TResult,TProgress>' being compiled 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(1054,26): error C2039: 'wait_for': is not a member of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(100): message : see declaration of 'winrt::impl' 1>C:\...\Windows.UI.Composition-Win32-Samples\cpp\HelloVectors\x64\Debug\Generated Files\winrt\impl\Windows.Foundation.0.h(1056): message : see reference to class template instantiation 'winrt::impl::consume_Windows_Foundation_IAsyncOperation<D,TResult>' being compiled
The text was updated successfully, but these errors were encountered: