You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cpp compiler complains about TU_VERIFY_STATIC with the following errors:
this declaration has no storage class or type specifier
too many initializer values
variable "_Static_assert" has already been defined
How to reproduce ?
Create an empty IAR project with including tinyUSB/src in search paths.
Add provided main.cpp
Try to compile.
Debug Log
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 303
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 303
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 314
Error[Pe247]: variable "_Static_assert" has already been defined (at line 303) tinyusb\src\common\tusb_types.h 314
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 314
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 330
Error[Pe247]: variable "_Static_assert" has already been defined (at line 303) tinyusb\src\common\tusb_types.h 330
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 330
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 347
Error[Pe247]: variable "_Static_assert" has already been defined (at line 303) tinyusb\src\common\tusb_types.h 347
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 347
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 368
Error[Pe247]: variable "_Static_assert" has already been defined (at line 303) tinyusb\src\common\tusb_types.h 368
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 368
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 400
Error[Pe247]: variable "_Static_assert" has already been defined (at line 303) tinyusb\src\common\tusb_types.h 400
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 400
Error[Pe077]: this declaration has no storage class or type specifier tinyusb\src\common\tusb_types.h 489
Error[Pe247]: variable "_Static_assert" has already been defined (at line 303) tinyusb\src\common\tusb_types.h 489
Error[Pe146]: too many initializer values tinyusb\src\common\tusb_types.h 489
Screenshots
No response
The text was updated successfully, but these errors were encountered:
The problem seems to come from IAR that defines __STDC_VERSION__ in cpp as well.
Which causes TU_VERIFY_STATIC to be defined as _Static_assert instead of cpp's static_assert.
A simple fix is to reorder __cplusplus__ to be first, then to fallback to __STDC_VERSION__ if not CPP.
Operating System
Windows 11
Board
Any
Firmware
Compile a simple cpp file including
tusb.h
What happened ?
Cpp compiler complains about
TU_VERIFY_STATIC
with the following errors:this declaration has no storage class or type specifier
too many initializer values
variable "_Static_assert" has already been defined
How to reproduce ?
Create an empty IAR project with including tinyUSB/src in search paths.
Add provided
main.cpp
Try to compile.
Debug Log
Screenshots
No response
The text was updated successfully, but these errors were encountered: