Hi, I am trying to compile a example code from Atmel, which was written for Atmel Studio IDE, GCC or IAR compilers, and getting the following error:
error: #59: function call is not allowed in a constant expression
This is an similar example of the code:
const sam_abc xy_settings = {function_yz(), 111, 250 };
- sam_abc is a struct - function_yz() is the function which causes the error
I am using µVision V4.54.0.0 (C Compiler: Armcc).
How could I solve this problem? Can someone please help me. Thanks in advance.
Jan
In my case, I added "GNU extensions" ticked in Target Build Options - C/C++ , removed this error.
Here's my new settings screenshot..
Just by disabling this GNU extensions, the error re-appears.
How do you add GNU extensions in version 5.36.0?
When i open this window i have these options:
By default it is c99 and i have some errors, although the code being clean, but when i choose gnu99 the error disappears.
Which one is recommended to use?