Windows - Juce 8.0.6 Builds Issues (juce_PushNotifications.h)

juce_pushNotifications.h is causing compile issues on Windows with update to Juce 8.0.6 both locally and on CI

relevant build info is as follows:

compiler:

C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe

Build failure:

FAILED: CMakeFiles/Project.dir/Plugin/Source/Processor/PluginProcessor.cpp.obj
C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1442~1.344\bin\Hostx64\x64\cl.exe /nologo /TP -DJUCE_DISPLAY_SPLASH_SCREEN=0 -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -DJUCE_MODULE_AVAILABLE_juce_audio_basics=1 -DJUCE_MODULE_AVAILABLE_juce_audio_devices=1 -DJUCE_MODULE_AVAILABLE_juce_audio_formats=1 -DJUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1 -DJUCE_MODULE_AVAILABLE_juce_audio_processors=1 -DJUCE_MODULE_AVAILABLE_juce_audio_utils=1 -DJUCE_MODULE_AVAILABLE_juce_core=1 -DJUCE_MODULE_AVAILABLE_juce_data_structures=1 -DJUCE_MODULE_AVAILABLE_juce_dsp=1 -DJUCE_MODULE_AVAILABLE_juce_events=1 -DJUCE_MODULE_AVAILABLE_juce_graphics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_basics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_extra=1 -DJUCE_SHARED_CODE=1 -DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone -DJUCE_VST3_CAN_REPLACE_VST2=0 -DJucePlugin_AAXCategory=0 -DJucePlugin_AAXDisableBypass=0 -DJucePlugin_AAXDisableMultiMono=0 -DJucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode -DJucePlugin_AAXProductId=JucePlugin_PluginCode -DJucePlugin_ARACompatibleArchiveIDs="" -DJucePlugin_ARAContentTypes=0 -DJucePlugin_ARATransformationFlags=0 -DJucePlugin_AUExportPrefix=Co_ProducerAU -DJucePlugin_AUExportPrefixQuoted="Co_ProducerAU" -DJucePlugin_AUMainType=“‘aufx’” -DJucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode -DJucePlugin_AUSubType=JucePlugin_PluginCode -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_LV2=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0 -DJucePlugin_Build_VST3=1 -DJucePlugin_Build_VST=0 -DJucePlugin_Desc="Project" -DJucePlugin_EditorRequiresKeyboardFocus=1 -DJucePlugin_Enable_ARA=0 -DJucePlugin_IsMidiEffect=0 -DJucePlugin_IsSynth=0 -DJucePlugin_ManufacturerEmail="" -DJucePlugin_ManufacturerWebsite="" -DJucePlugin_PluginCode=0x436f7072 -DJucePlugin_ProducesMidiOutput=0 -DJucePlugin_VSTCategory=kPlugCategEffect -DJucePlugin_VSTNumMidiInputs=16 -DJucePlugin_VSTNumMidiOutputs=16 -DJucePlugin_VSTUniqueID=JucePlugin_PluginCode -DJucePlugin_Version=0.6.0 -DJucePlugin_VersionCode=0x600 -DJucePlugin_VersionString="0.6.0" -DJucePlugin_Vst3Category=“"Fx|Tools"” -DJucePlugin_WantsMidiInput=0 -DLAGER_DISABLE_STORE_DEPENDENCY_CHECKS -DNDEBUG=1 -DSENTRY_BUILD_STATIC -DZUG_VARIANT_STD -D_NDEBUG=1 -DelastiquePro_REVISION=f6b1987 -DelastiquePro_VERSION_MAJOR=3 -DelastiquePro_VERSION_MINOR=4 -DelastiquePro_VERSION_PATCH=7 -DelastiquePro_VERSION_STRING="3.4.7+f6b1987" -DelastiqueSOLOIST_REVISION=99a3ba0 -DelastiqueSOLOIST_VERSION_MAJOR=2 -DelastiqueSOLOIST_VERSION_MINOR=2 -DelastiqueSOLOIST_VERSION_PATCH=7 -DelastiqueSOLOIST_VERSION_STRING="2.2.7+99a3ba0"7\MT\include -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -std:c++20 -MT /WX /bigobj /W4 /Ox /MP /EHsc -GL /Zc:__cplusplus /showIncludes /FoCMakeFiles\Project.dir\Plugin\Source\Processor\PluginProcessor.cpp.obj /FdCMakeFiles\Project.dir\Project.pdb /FS -c C:\Users\circleci\project\Plugin\Source\Processor\PluginProcessor.cpp

C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(309): error C2144: syntax error: ‘char’ should be preceded by ‘}’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(309): error C2062: type ‘char’ unexpected
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(311): error C2143: syntax error: missing ‘;’ before ‘}’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(311): error C2238: unexpected token(s) preceding ‘;’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(313): error C3646: ‘badgeIconType’: unknown override specifier
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(313): error C2059: syntax error: ‘=’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(313): error C2238: unexpected token(s) preceding ‘;’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(397): error C2653: ‘Notification’: is not a class or namespace name
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(397): error C2061: syntax error: identifier ‘Action’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(407): error C2065: ‘Action’: undeclared identifier
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(407): error C2923: ‘juce::Array’: ‘Action’ is not a valid template type argument for parameter ‘ElementType’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(407): note: see declaration of ‘Action’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(407): error C2976: ‘juce::Array’: too few template arguments
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_Array.h(67): note: see declaration of ‘juce::Array’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(407): error C2955: ‘juce::Array’: use of class template requires template argument list
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_Array.h(67): note: see declaration of ‘juce::Array’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(471): error C2653: ‘Notification’: is not a class or namespace name
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(471): error C3646: ‘lockScreenAppearance’: unknown override specifier
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(471): error C2059: syntax error: ‘=’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(471): error C2653: ‘Notification’: is not a class or namespace name
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(471): error C2238: unexpected token(s) preceding ‘;’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(507): error C2270: ‘getPendingLocalNotifications’: modifiers not allowed on nonmember functions
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(519): error C2270: ‘areNotificationsEnabled’: modifiers not allowed on nonmember functions
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(525): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(525): error C2143: syntax error: missing ‘,’ before ‘&’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(534): error C2270: ‘getDeliveredNotifications’: modifiers not allowed on nonmember functions
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(549): error C2270: ‘getDeviceToken’: modifiers not allowed on nonmember functions
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(616): error C2065: ‘Notification’: undeclared identifier
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(616): error C2923: ‘juce::Array’: ‘Notification’ is not a valid template type argument for parameter ‘ElementType’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(616): note: see declaration of ‘Notification’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(616): error C2976: ‘juce::Array’: too few template arguments
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_Array.h(67): note: see declaration of ‘juce::Array’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(616): error C2955: ‘juce::Array’: use of class template requires template argument list
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_Array.h(67): note: see declaration of ‘juce::Array’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(630): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(630): error C2143: syntax error: missing ‘,’ before ‘&’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(647): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(647): error C2143: syntax error: missing ‘,’ before ‘&’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(654): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(654): error C2143: syntax error: missing ‘,’ before ‘&’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(663): error C2065: ‘Notification’: undeclared identifier
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(663): error C2923: ‘juce::Array’: ‘Notification’ is not a valid template type argument for parameter ‘ElementType’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(663): note: see declaration of ‘Notification’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(663): error C2976: ‘juce::Array’: too few template arguments
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_Array.h(67): note: see declaration of ‘juce::Array’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(663): error C2955: ‘juce::Array’: use of class template requires template argument list
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_Array.h(67): note: see declaration of ‘juce::Array’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(693): error C2059: syntax error: ‘private’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(694): error C2059: syntax error: ‘)’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(695): error C2588: ‘::~PushNotifications’: illegal global destructor
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(695): error C3158: ‘PushNotifications’: ‘override’ can only be applied to a virtual member function
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(695): error C2575: ‘PushNotifications’: only member functions and bases can be virtual
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(695): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2039: ‘Listener’: is not a member of ‘juce::PushNotifications’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(54): note: see declaration of ‘juce::PushNotifications’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2275: ‘juce::Listener’: expected an expression instead of a type
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): note: prefix the qualified-id with ‘typename’ to indicate a type
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2923: ‘juce::ListenerList’: ‘juce::Listener’ is not a valid template type argument for parameter ‘ListenerClass’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(600): note: see declaration of ‘juce::Listener’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2976: ‘juce::ListenerList’: too few template arguments
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_ListenerList.h(71): note: see declaration of ‘juce::ListenerList’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2641: cannot deduce template arguments for ‘juce::ListenerList’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2783: ‘juce::ListenerList<ListenerClass,ArrayType> juce::ListenerList(void)’: could not deduce template argument for ‘ListenerClass’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_ListenerList.h(76): note: see declaration of ‘juce::ListenerList’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(697): error C2780: ‘juce::ListenerList<ListenerClass,ArrayType> juce::ListenerList(juce::ListenerList<ListenerClass,ArrayType>)’: expects 1 arguments - 0 provided
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_core\containers/juce_ListenerList.h(71): note: see declaration of ‘juce::ListenerList’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(710): error C2059: syntax error: ‘}’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_PushNotifications.h(710): error C2143: syntax error: missing ‘;’ before ‘}’
C:\Users\circleci\project\build\vcpkg_installed\x64-windows-static\share\JuceModules\juce_gui_extra\misc/juce_RecentlyOpenedFilesList.h(36): error C2143: syntax error: missing ‘;’ before ‘{’

1 Like

update -

I was able to figure out the problem - “small” is #define in rpcndr.h which is transitively included in juce_gui_extra.h, which causes compile errors
in juce_pushNotifications.h when since it uses “small” as an enum value for BadgeIconType on line 317.

adding the following to juce_pushNotifications.h fixes the issue.

#if JUCE_WINDOWS && defined(small)
    #undef small
#endif
1 Like

We just came up against this, and it seems it happens if windows.h is included before JUCE headers. So we were able to fix without patching juce with:

#include <windows.h>
#ifdef small
#undef small
#endif

Bumping this, this causes my Windows build to fail. Can this be fixed please?

I’m not sure whether it’s JUCE’s job to fix this. I think this error will only happen in the case where the include order is e.g.

#include <juce_core.h>
#include <windows.h>
#include <juce_gui_extra.h>

juce_core.h already undefs small, but then windows.h redefines it, which then breaks the later juce_gui_extra.h inclusion. This can be resolved by switching the include order around, so that all JUCE headers get included before windows.h.

It’s not reasonable to expect JUCE headers to protect against any possible macro definition. With windows.h, it’s not just small that causes problems, but also min and max. It’s also easy to imagine a similar problem arising when including some header other than windows.h, which defines a commonly-used token.

Are you able to fix your build by tweaking your include order? If not, please provide some more details so that we can suggest a suitable workaround.

1 Like

Nowhere in my code am I manually including windows.h, this only comes transitively from Juce headers.

The compiler error I get suggests that the error occurs when compiling the juce_gui_basics translation unit, which is why I thought this needed to be a Juce fix or patch.

What’s the actual text of the error message? Is the problem with small being defined, or some other token? Are you able to find where the problematic definition is coming from?

I don’t know if this will be helpful, but there is an option in Visual Studio to show the includes during the build. I often use this to help diagnose issues related to include files.

1 Like