Search code examples
c++xilinxvivadozynq

ERROR: unable to find numeric literal operator 'operator""U'?


I am using ARM v7 g++ compiler on Vivado and SDK 2017.4. I had the same code working without any problem, but now it is throwing this error after changing something which is not related with this, apparently. I have undone the changes but it still complains.

../../MicroZed_design9_bsp/ps7_cortexa9_0/include/xparameters.h:557:40: error: unable to find numeric literal operator 'operator""U'
#define XPAR_AXI_TIMER_0_CLOCK_FREQ_HZ 1e+08U

Where is this coming from?


Solution

  • U is not valid at the end of a floating point literal. Valid suffixes are f or F to indicate a float, l or L to indicate a long double, and no suffix to default to double. U to indicate unsigned can only be used at the end of an integer literal.

    So 1e+08U is not valid because 1e+08 is the syntax for a floating point literal. Exponential notation can't be used for integers. If you want an unsigned long integer, write 100000000UL.