M5GFX.h:298:38: error: conflicting declaration 'using EncodeRange = struct lgfx::v1::EncodeRange
I receive this error at compile time. Program used to work, but I now added M5GFX library to be able to draw a circle, and now it won't compile anymore. error message: [{ "resource": "/home/jan/PlatformIO/Projects/AubineWerkend/M5stackCore2/.pio/libdeps/m5stack-core2/M5GFX/src/M5GFX.h", "owner": "cpp", "severity": 8, "message": "conflicting declaration 'using EncodeRange = struct lgfx::v1::EncodeRange'", "startLineNumber": 298, "startColumn": 38, "endLineNumber": 298, "endColumn": 38 }]
my platform.ini: ; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html
[platformio] default_envs = m5stack-core2
[env] build_type = debug framework = arduino lib_ldf_mode = deep monitor_speed = 115200 lib_deps =
[espressif32_base] platform = espressif32 build_unflags = -Werror=reorder board_build.partitions = min_spiffs.csv monitor_filters = esp32_exception_decoder
[env:m5stack-core2] extends = espressif32_base board = m5stack-core2 build_flags = -D M5CORE2 -D HOST="m5core2" -D M5IIMU -D A0=26 -D SERIAL_DEBUG_DISABLED -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE upload_port = /dev/ttyACM0 monitor_port = /dev/ttyACM0 lib_deps = m5stack/M5Core2@^0.1.2 signalk/SensESP@^3.1.1 m5stack/M5GFX@^0.2.9
In file M5GFX.h I commented out the following lines (at the bottom of the file): /* #ifdef USE_M5_FONT_CREATOR using EncodeRange = lgfx::EncodeRange; #endif */ And now it compiles, and the code works as far as I can see !
Hello, @on4ain At least this is a feature, not a bug. It's important to note that if you use the M5Core2 library, you should either not use M5GFX or include it after the M5Core2 library.
thanks for your comment ! Is that also true for the M5unified library ? I'm just re-learning C after 30 years of inactivity in C ...
When using M5Unified, M5GFX is used internally. Since M5.Display is an instance of M5GFX, users do not need to explicitly include M5GFX.
Note that the M5Core2 library and M5Unified library cannot coexist, so please choose which one to use as appropriate.
If you use M5Unified, this document will be helpful. https://docs.m5stack.com/en/arduino/m5unified/helloworld