martinberlin / cale-idf

CalEPD is an Epaper component driver for the ESP-IDF framework with GFX and font support, optional touch interface, compatible with ESP32 / S2 / S3 / C3
https://fasani.de
Apache License 2.0
270 stars 24 forks source link

Build problems "Gdeh0213b73.h" #59

Closed AleshR closed 2 years ago

AleshR commented 2 years ago

Hi, i have problem with building example for Gdeh0213b73.

Source:

#include <stdio.h>
#include <gdeh0213b73.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

// Two lines to start IO and instantiate your model
EpdSpi io;
Gdeh0213b73 display(io);

extern "C"
{
   void app_main();
}

void app_main(void) {
   display.init(true);
   display.setRotation(0); 
   display.println("Hello world");
   // Print a 2 pix line
   for (int i = 0; i < display.width(); i++) {
     display.drawPixel(i,10,EPD_BLACK);
     display.drawPixel(i,11,EPD_BLACK);
   }
   // Discover more of the geometrical functions of Adafruit GFX typing  display.*
}

Also i updated sdkconfig for TTGO-t5

cp ttgo-t5-sdkconfig ../sdkconfig

and

CMakeList.txt SRCS "demos/gdeh0213b74_test.cpp"

After idf.py build i get errors like this:

/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj):(.literal._Z41__static_initialization_and_destruction_0ii+0x10): undefined reference to `vtable for Gdeh0213b73'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj):(.literal._Z41__static_initialization_and_destruction_0ii+0x14): undefined reference to `VTT for Gdeh0213b73'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj):(.literal._Z41__static_initialization_and_destruction_0ii+0x18): undefined reference to `Gdeh0213b73::Gdeh0213b73(EpdSpi&)'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj):(.literal.app_main+0xc): undefined reference to `Gdeh0213b73::init(bool)'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj):(.literal.app_main+0x10): undefined reference to `Gdeh0213b73::drawPixel(short, short, unsigned short)'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj): in function `__static_initialization_and_destruction_0(int, int)':
/home/alesh/esp/cale-idf/main/demos/gdeh0213b74_test.cpp:8: undefined reference to `Gdeh0213b73::Gdeh0213b73(EpdSpi&)'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(gdeh0213b74_test.cpp.obj): in function `app_main':
/home/alesh/esp/cale-idf/main/demos/gdeh0213b74_test.cpp:16: undefined reference to `Gdeh0213b73::init(bool)'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/alesh/esp/cale-idf/main/demos/gdeh0213b74_test.cpp:20: undefined reference to `Gdeh0213b73::drawPixel(short, short, unsigned short)'
/home/alesh/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/alesh/esp/cale-idf/main/demos/gdeh0213b74_test.cpp:21: undefined reference to `Gdeh0213b73::drawPixel(short, short, unsigned short)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/cale-epd.elf.dir/build.make:505: cale-epd.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:2113: CMakeFiles/cale-epd.elf.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
make failed with exit code 2

Now it takes me about two days to debug and i have no ideas why it's not working. Every hint or ideas will be helpful. Thanks!

martinberlin commented 2 years ago

I think CMakeLists is not including that class:

    # Pending for more testing:
    #"models/gdeh0213b73.cpp"

Try to uncomment that and build again. When you see this kind of "vtable" errors is because the compiler is not finding the class.