Closed Gavin-Williams closed 1 year ago
I'm not as familiar with this sample, but it looks like something may have changed with the bundled version of cppwinrt in that version of the SDK. I had to make two changes to get this to compile:
diff --git a/cpp/AdvancedColorImages/AdvancedColorImages/AdvancedColorImages.cpp b/cpp/AdvancedColorImages/AdvancedColorImages/AdvancedColorImages.cpp
index 8f38aa4..7dccc34 100644
--- a/cpp/AdvancedColorImages/AdvancedColorImages/AdvancedColorImages.cpp
+++ b/cpp/AdvancedColorImages/AdvancedColorImages/AdvancedColorImages.cpp
@@ -141,7 +141,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
return FALSE;
}
- m_winComp = new WinComp();
+ m_winComp = winrt::make_self<WinComp>().detach();^M
// Ensure that the DispatcherQueue is initialized. This is required by the Compositor.
auto controller = m_winComp->EnsureDispatcherQueue();
diff --git a/cpp/AdvancedColorImages/AdvancedColorImages/stdafx.h b/cpp/AdvancedColorImages/AdvancedColorImages/stdafx.hindex d322e82..9565762 100644
--- a/cpp/AdvancedColorImages/AdvancedColorImages/stdafx.h
+++ b/cpp/AdvancedColorImages/AdvancedColorImages/stdafx.h
@@ -18,7 +18,8 @@
#include <shobjidl_core.h>
#include <ppltasks.h>
-
+#include <winrt/Windows.Foundation.h>
+#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.System.h>
#include <winrt/Windows.Storage.h>
#include <winrt/Windows.Storage.Streams.h>
@@ -31,7 +32,7 @@
#include <winrt/Windows.Graphics.DirectX.h>
#include <winrt/Windows.Web.Syndication.h>
-WINRT_WARNING_PUSH
+//WINRT_WARNING_PUSH
#include <dxgi1_6.h>
#include <d2d1_3.h>
Hopefully that gets you unblocked for now.
I get the following errors
C2144 syntax error: 'IDXGIAdapter4' should be preceded by ';' AdvancedColorImages C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\shared\dxgi1_6.h 52
C4430 missing type specifier - int assumed. Note: C++ does not support default-int AdvancedColorImages C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\shared\dxgi1_6.h 52
Also, Intellisense is showing an error at line 144 of AdvancedColorImages.cpp
m_winComp = new WinComp(); // object of abstract type WinComp is not allowed