lexus2k / lcdgfx

Driver for LCD displays running on Arduino/Avr/ESP32/Linux (including Rasperry) platforms
MIT License
377 stars 52 forks source link

Cannot build using this library for esp32 #60

Closed blmhemu closed 3 years ago

blmhemu commented 3 years ago

Describe the bug Cannot build using the library.

To Reproduce

  1. Go to esp-arduino-blink example in platformio
  2. Add this library as dependency
  3. use #include "lcdgfx.h" in the main.cpp
  4. Build the project.

Expected behavior Program should build

Screenshots image Looks like the attach interrupt in being exported by two libraries (esp-arduino and this lib) ?

Please complete the following information:

Additional context None

lexus2k commented 3 years ago

Hi,

Can you try to add -DARDUINO to your project defines?

The conflict happens because you're using aduino-esp32 which has arduino API, but the library is being compiled as library for ESP32-IDF

blmhemu commented 3 years ago

Thanks for the quick response!

image After I added -D ARDUINO I got the above error

Actually, I am using both Arduino AND esp-idf (Both of them as the project is dependent on some Arduino libs)

Here is my new platformio.ini

[env]
platform = espressif32
framework = arduino, espidf
build_flags = 
    -D CONFIG_BLINK_GPIO=25
    -D ARDUINO
monitor_speed = 115200
platform_packages = 
    framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0

[env:heltec_wifi_lora_32_V2]
board = heltec_wifi_lora_32_V2
lib_deps = lexus2k/lcdgfx@^1.1.0

Also I was able to get it to working if I remove #include <Arduino> and the related code.

lexus2k commented 3 years ago

Please, find the fix on the master branch (latest commit), ARDUINO define is not required.

blmhemu commented 3 years ago

Greetings ! @lexus2k That was a nice fix. The problem can be marked as resolved In master. Eager to see it in the new release!

Also, there are a lot of warnings during compiling (fortunately none are fatal)

image

My guess is that some items are being redefined in both libs.

Once again thanks for the quick fix!