Onion Dashboard C++ Cross Compile for LVGL Example



  • Re: Onion Community Guidelines & Terms of Service

    I am exploring the use of the Omega Dashboards for industrial controls applications,

    My interest is to develop in C++, I have followed all your suggestions and articles related to cross-compiling with docker container.

    the github clone that you have published has inconsistencies in the libs, after extensive work I achieved a set without errors, however when compiling with: g++ main.cpp -o lvgltest

    I got the nest list of errors:

    /tmp/ccz5xXaq.o: In function lv_scr_act': main.cpp:(.text+0x5): undefined reference to lv_disp_get_default'
    main.cpp:(.text+0xd): undefined reference to lv_disp_get_scr_act' /tmp/ccz5xXaq.o: In function main':
    main.cpp:(.text+0x7b): undefined reference to lv_init' main.cpp:(.text+0x80): undefined reference to fbdev_init'
    main.cpp:(.text+0x99): undefined reference to lv_disp_buf_init' main.cpp:(.text+0xa5): undefined reference to lv_disp_drv_init'
    main.cpp:(.text+0xb5): undefined reference to fbdev_flush' main.cpp:(.text+0xc1): undefined reference to lv_disp_drv_register'
    main.cpp:(.text+0xd0): undefined reference to lv_indev_drv_init' main.cpp:(.text+0xe2): undefined reference to xpt7603_read'
    main.cpp:(.text+0xf1): undefined reference to lv_indev_drv_register' main.cpp:(.text+0x103): undefined reference to lv_label_create'
    main.cpp:(.text+0x11e): undefined reference to lv_label_set_text' main.cpp:(.text+0x142): undefined reference to lv_obj_align'
    main.cpp:(.text+0x154): undefined reference to lv_btn_create' main.cpp:(.text+0x16f): undefined reference to lv_obj_set_event_cb'
    main.cpp:(.text+0x193): undefined reference to lv_obj_align' main.cpp:(.text+0x1a7): undefined reference to lv_label_create'
    main.cpp:(.text+0x1c2): undefined reference to lv_label_set_text' main.cpp:(.text+0x1d6): undefined reference to lv_tick_inc'
    main.cpp:(.text+0x1db): undefined reference to `lv_task_handler'
    collect2: error: ld returned 1 exit status

    Can you help me with any recommendations? Do you have an update of the set of programs, without errors, for c++ cross compile?

    Thanks


  • administrators

    @jcrfMX Judging by your compile command and the errors, it looks like you're not linking the lvgl libraries.

    Take a look at the makefile in the OnionIoT/lv_example repo for reference on building a program that uses lvgl.
    It's been a minute since I've written C++ that uses C, but I think you'll also need to research how to use C libraries in C++.

    Let us know how it goes!



  • @jcrfMX There is a lot of info on LVGL Forum that can adress your concerns. @Lazar-Demin is correct in that the errors being reported indicate you have not correctly added the lvgl headers and libs to your include path library paths.

    There is nothing special about using LVGL in a C++ application compared to any other C/C++ project, the LVGL Forum has numerous discussions related to this but there's nothig unique about LVGL in this.

    With regard to the Dash and LVGL, the main area you need understand is the lv_conf.h and the driver configuration, other than that the Dash is a like any other LVGL project.



Looks like your connection to Community was lost, please wait while we try to reconnect.