Need to understand how to define the location of lv_conf.h

Hi everybody,
I recently changed the model of my display, going from SC32-01 to SC01plus… more memory and not the same display.
going through several tests with multiples drivers and platforms, I always have the same problem.
after reinstalling the driver, I always have a compilation error :
“fatal error: …/…/lv_conf.h: No such file or directory
#include “…/…/lv_conf.h” /Else assume lv_conf.h is next to the lvgl folder/”

I normally solve this problem by modifying the line 41 of “LV_CONF_INCLUDE_SIMPLE” from

#include "../../lv_conf.h"
//to
#include "lv_conf.h"

and it’s working fine but I really don’t like it.
according to this code:

#ifndef LV_CONF_SKIP
    #ifdef LV_CONF_PATH                           /*If there is a path defined for lv_conf.h use it*/
        #define __LV_TO_STR_AUX(x) #x
        #define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
        #include __LV_TO_STR(LV_CONF_PATH)
        #undef __LV_TO_STR_AUX
        #undef __LV_TO_STR
    #elif defined(LV_CONF_INCLUDE_SIMPLE)         /*Or simply include lv_conf.h is enabled*/
        #include "lv_conf.h"
    #else
        #include "../../lv_conf.h"                /*Else assume lv_conf.h is next to the lvgl folder*/
    #endif
#endif

if LV_CONF_INCLUDE_SIMPLE is defined, that should solve this problem…
I’ve tried to do #define LV_CONF_INCLUDE_SIMPLE at the first line of my code but it doesn’t work…

is someone can help me to do this properly instead of badly modifying a really good library?

Thank you for your help.

I’m using PlatformIO and lvgl v8.4.
I put lv_conf.h in the include dir of my project.

If I remember correctly, this worked:

platformio.ini

build_flags = 
  -D LV_CONF_INCLUDE_SIMPLE
  -I include

but I’m now using the simpler

build_flags = 
  -D LV_CONF_PATH="${PROJECT_DIR}/include/lv_conf.h"
2 Likes

Hey, I have tried all diff combinations of placing lv_conf.h but it ignores it. It is too big so I am trying to remove fonts I do not need, but it still compiles them?

#define LV_FONT_MONTSERRAT_22 1

#define LV_FONT_MONTSERRAT_24 1

#define LV_FONT_MONTSERRAT_26 1

// #define LV_FONT_MONTSERRAT_28 1

// #define LV_FONT_MONTSERRAT_30 1

// #define LV_FONT_MONTSERRAT_32 1

// #define LV_FONT_MONTSERRAT_34 1

// #define LV_FONT_MONTSERRAT_36 1

// #define LV_FONT_MONTSERRAT_38 1

// #define LV_FONT_MONTSERRAT_40 1

// #define LV_FONT_MONTSERRAT_42 1

// #define LV_FONT_MONTSERRAT_44 1

// #define LV_FONT_MONTSERRAT_46 1

// #define LV_FONT_MONTSERRAT_48 1

Amazing, worked for me! I tried moving lv_conf.h to \include and then to \src and got the same error. Did some searching, found this comment, and all working by moving it back to \include adding the build_flags = -D LV_CONF_PATH=“${PROJECT_DIR}/include/lv_conf.h”.

Thank you @rev