VasilKalchev / LiquidMenu

Menu creation Arduino library for LCDs, wraps LiquidCrystal.
MIT License
285 stars 53 forks source link

'recognizeType(int&)' is ambiguous #110

Closed onolox closed 5 months ago

onolox commented 11 months ago

Is there an existing issue for this?

Library version

Yes, from Arduino library manager.

Bug description

Hi, when using your library in arduino is fine, but if I use stm32 appears this error:

\LiquidMenu\src/LiquidMenu.h:428:37: error: call of overloaded 'recognizeType(int&)' is ambiguous

Can you make an C STM32 compatible version?

[env:genericSTM32F103C8] platform = ststm32 board = genericSTM32F103C8 framework = arduino lib_deps = fmalpartida/LiquidCrystal@^1.5.0 vase7u/LiquidMenu@^1.6.0 adafruit/Adafruit Unified Sensor@^1.1.13 bxparks/AceButton@^1.10.1 greiman/SdFat@^2.2.2 toannv17/DHT Sensors Non-Blocking@^1.0.4

Compiler output

In file included from .pio\libdeps\genericSTM32F103C8\LiquidCrystal/LiquidCrystal.h:45,
                 from src\main.cpp:3:
.pio\libdeps\genericSTM32F103C8\LiquidCrystal/FastIO.h:217:106: warning: 'boolean' is deprecated [-Wdeprecated-declarations]
  217 | void fio_shiftOut1(fio_register shift1Register, fio_bit shift1Bit, uint8_t value, boolean noLatch = false);
      |                                                                                                          ^
In file included from C:\Users\Fabio\.platformio\packages\framework-arduinoststm32\cores\arduino/wiring.h:34,
                 from C:\Users\Fabio\.platformio\packages\framework-arduinoststm32\cores\arduino/Arduino.h:36,
                 from src\main.cpp:1:
C:\Users\Fabio\.platformio\packages\framework-arduinoststm32\cores\arduino/wiring_constants.h:110:14: note: declared here
  110 | typedef bool boolean __attribute__((deprecated));
      |              ^~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidCrystal/FastIO.h:225:71: warning: 'boolean' is deprecated [-Wdeprecated-declarations]
  225 | void fio_shiftOut1(uint8_t pin, uint8_t value, boolean noLatch = false);
      |                                                                       ^
C:\Users\Fabio\.platformio\packages\framework-arduinoststm32\cores\arduino/wiring_constants.h:110:14: note: declared here
  110 | typedef bool boolean __attribute__((deprecated));
      |              ^~~~~~~
In file included from src\main.cpp:4:
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h: In instantiation of 'bool LiquidLine::add_variable(T&) [with T = int]':
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:372:17:   required from 'LiquidLine::LiquidLine(uint8_t, uint8_t, A&, B&) [with A = const char [6]; B = int; uint8_t = unsigned char]' 
src\main.cpp:54:51:   required from here
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:428:37: error: call of overloaded 'recognizeType(int&)' is ambiguous
  428 |     DataType varType = recognizeType(variable);
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:149:10: note: candidate: 'DataType recognizeType(bool)'
  149 | DataType recognizeType(bool variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:155:10: note: candidate: 'DataType recognizeType(char)'
  155 | DataType recognizeType(char variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:173:10: note: candidate: 'DataType recognizeType(int8_t)'
  173 | DataType recognizeType(int8_t variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:179:10: note: candidate: 'DataType recognizeType(uint8_t)'
  179 | DataType recognizeType(uint8_t variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:185:10: note: candidate: 'DataType recognizeType(int16_t)'
  185 | DataType recognizeType(int16_t variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:191:10: note: candidate: 'DataType recognizeType(uint16_t)'
  191 | DataType recognizeType(uint16_t variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:197:10: note: candidate: 'DataType recognizeType(int32_t)'
  197 | DataType recognizeType(int32_t variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:203:10: note: candidate: 'DataType recognizeType(uint32_t)'
  203 | DataType recognizeType(uint32_t variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:209:10: note: candidate: 'DataType recognizeType(float)'
  209 | DataType recognizeType(float variable);
      |          ^~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\LiquidMenu\src/LiquidMenu.h:215:10: note: candidate: 'DataType recognizeType(double)'
  215 | DataType recognizeType(double variable);
      |          ^~~~~~~~~~~~~
*** [.pio\build\genericSTM32F103C8\src\main.cpp.o] Error 1
=================================================================================== [FAILED] Took 3.83 seconds ===================================================================================
FabioM3 commented 11 months ago

Use the types that exist in recognizeType.cpp, like uint16_t.