Projucer App (source) and Prebuilt Projuicer will not compile projects on VS2017


#1

Won’t compile on Visual Studio 2017.

  1. Won’t compile with Windows SDK version 10.0.14393.0
    The error is:
    \juce\modules\juce_gui_basics\native/juce_win32_Windowing.cpp(382): error C2065: ‘DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2’: undeclared identifier (compiling source file …\JuceLibraryCode\include_juce_gui_basics.cpp)
  2. Should build projuicer app
  3. Windows 10
  4. X64

#2

As an immediate solution, you can use “Visual Studio Installer” to install a more recent Windows 10 SDK:

  • 10.0.15063.0
  • 10.0.16299.0
  • 10.0.17134.0
  • 10.0.17763.0

I’m currently installing 10.0.14393.0 on my machine and will try to provide a fix proposal for JUCE.


#3

C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared\windef.h contains the following:

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

#define _DPI_AWARENESS_CONTEXTS_

DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);

typedef enum DPI_AWARENESS {
    DPI_AWARENESS_INVALID           = -1,
    DPI_AWARENESS_UNAWARE           = 0,
    DPI_AWARENESS_SYSTEM_AWARE      = 1,
    DPI_AWARENESS_PER_MONITOR_AWARE = 2
} DPI_AWARENESS;

#define DPI_AWARENESS_CONTEXT_UNAWARE           ((DPI_AWARENESS_CONTEXT)-1)
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE      ((DPI_AWARENESS_CONTEXT)-2)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)

#endif

It defines _DPI_AWARENESS_CONTEXTS_, but doesn’t define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2.

@ed95 I propose to apply the following patch to be able to use that Windows SDK:

diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp
index 72c719c64..d5ed798ff 100644
--- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp
+++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp
@@ -269,6 +269,10 @@ extern void* getUser32Function (const char*);
  #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT) - 4)
 #endif

+#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
+ #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT) - 4)
+#endif
+
 //==============================================================================
 typedef BOOL (WINAPI* RegisterTouchWindowFunc)   (HWND, ULONG);
 typedef BOOL (WINAPI* GetTouchInputInfoFunc)     (HTOUCHINPUT, UINT, TOUCHINPUT*, int);

#4

Yep, I’ll get that sorted. Thanks @McMartin.