Problems building in Xilinx SDK: nontrivial designated initializers error

I’m getting an error building lvgl for a Xilinx Zynq project in SDK 2016.4 that I can’t seem to get rid of. I expect it has something to do with C/C++ build settings. This error is coming from the font files:
“sorry, unimplemented: non-trivial designated initializers not supported”

Since everything claims to be C++ compile capable, I’m not sure where the problem is coming from, any help is appreciated!

Please give a specific line number. Also, are you compiling LittlevGL as C files or C++ files?

Here it is. The project is C++ by default, but I’ve got other C source code linked in. I could be showing off just how much I don’t know about compiler flags and IDE settings. I’m usually an analog hardware guy! Advice greatly appreciated (will donate!)

It looks like it can’t handle designated initializers:

struct mytest {
    int a;
    int b;
struct mytest myvar = { /* compiler does not like designated initializers */
    .b = 3,
    .a = 2

That’s going to be a bit of an issue. Designated initializers are part of the C99 spec, so I think your compiler must not support C99 fully. Unfortunately, LittlevGL requires a C99-compliant compiler.

Do you know what compiler you are using? I think this is the first time someone has had problems with these types of initializers.

Here’s a look at compilers in the project:

I have read that C++ doesn’t support C99 spec.
Do you think it’s just an issue with the font files? If so is there a manual formatting change I can make?

@creatorlars It looks like you are using GCC. That means that LittlevGL should work, as long as it is compiled as C code.

The error you are getting makes me think that you are compiling it as C++ (even if that isn’t your intention).

Is there a way to get a debug log from your IDE that will show the arguments passed to the compiler and the compiler’s name (i.e. arm-none-eabi-gcc vs arm-none-eabi-g++)?

1 Like

I also don’t remember that anybody had a problem with this so far. I’m very curious about this issue.

Well y’all led me to the answer, in any case!! Adding a “-x c” compiler flag to the lvgl folder has resolved the issue. Screenshot attached for future reference if any Xilinx SDK issues pop up:

1 Like