when compiling littlevgl v7.11.0 with c++14 on iar 8.32.2, reporting errors about LV_COLOR_MAKE(r, g, b); which is “expected an expression”
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using?
What do you want to achieve?
compile littlevgl with c++14 on iar 8.32.2
What have you tried so far?
when compiling static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) and lv_color_t ct = LV_COLOR_TRANSP; compiler complaining about “expected an expression”
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
Welcome to the wonderful world of LVGL!
This is more an FYI than a fix to your issue. I use LVGL with IAR Workbench 8.50.9 targeting an iMXRT1064 with no issues. However, I compile LVGL as a C library in a separate project. When I switch to C++ I get a whole slew of other errors (838 in total) along the lines of
Error[Pe144]: a value of type "void *" cannot be used to initialize an entity of type "lv_.... so my guess is you have “fixed” those in some way before arriving at the issue with
Also, in my application I use a mixed project (C & C++) with no problem i.e. I have the compiler set to
LVGL headers should be able to be included by C++ code without issues, but the source files themselves need to be compiled as C code.
hi jupeos, embeddedt，thank you all, thanks for your comments.
To avoid compiling the macro #define LV_COLOR_MAKE(r8, g8, b8) LV_CONCAT(LV_COLOR_MAKE, LV_COLOR_DEPTH)(r8, g8, b8) ,
so changing static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) into an usual function call which is lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b),
then the compiler of c++14 on iar 8.32.2 compiled lvgl_v7.11.0 without errors.
For some reason I suppose the c++14 compiler somehow doesn’t handle the LV_COLOR_MAKE marco as expected.