-2

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?

Micha Wiedenmann
  • 19,979
  • 21
  • 92
  • 137
Cerilet
  • 3
  • 1
  • 3

1 Answers1

3

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.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Thanks for your answer Barmar. I see. The problem is that this file is autogenerated by the software and it compiled before. So I have no idea what is going on. – Cerilet Jan 30 '18 at 08:18
  • Ok, I have found a _temporary_ solution. I do not know how it happened because is Vivado who generated this line, which is linked to the AXI clock (100MHz). `#define XPAR_AXI_TIMER_0_CLOCK_FREQ_HZ 1e+08U`. I have removed the exponent and now it compiles. `#define XPAR_AXI_TIMER_0_CLOCK_FREQ_HZ 100000000U`. However, I have no clue why the code compiled before. I have not changed the AXI clock from the previous version to this one. Thanks @Barmar for your answer. – Cerilet Jan 30 '18 at 08:55