conflict between definitions of void/VOID in STM32Cube generated code
04:49 24 Jan 2026

I have just moved up from STM32F4xx to STM32H562, and lots of things are done in a different way. In particular, two new middleware modules FILEX and USBX have replaced FATFS and USB... and they don't seem to get on.

FILEX #defines VOID as void, and USBx typedefs void as VOID: the compiler isn't happy, and produces this error message:

In file included from ../Middlewares/ST/filex/common/inc/fx_api.h:118,
                 from ../FileX/App/app_filex.h:30,
                 from ../Core/Src/main.c:21:
../Middlewares/ST/filex/ports/generic/inc/fx_port.h:90:49: error: two or more data types in declaration specifiers
   90 | #define VOID                                    void
      |                                                 ^~~~
../Middlewares/ST/usbx/ports/generic/inc/ux_port.h:83:49: note: in expansion of macro 'VOID'
   83 | typedef void                                    VOID;
      |                                                 ^~~~
In file included from ../Middlewares/ST/usbx/common/core/inc/ux_api.h:149,
                 from ../USBX/App/app_usbx_device.h:29,
                 from ../Core/Src/main.c:22:
../Middlewares/ST/usbx/ports/generic/inc/ux_port.h:83:1: warning: useless type name in empty declaration
   83 | typedef void                                    VOID;
      | ^~~~~~~

Is there a solution somewhere to this snake-eating-tail problem?

stm32cubeide