-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile error: error: no matching function for call to 'max(uint16_t&, int)' #58
Comments
Interestingly, I am running into a similar issue with Generic ESP8266 @mishomvp if you resolve, please make sure to post here and I will do likewise. I have not got a chance to dive very deeply into it but the errors seem to come from comparisons of two values that are cast differently. I seem to be able to get rid of them when I cast each value explicitly (eg Getting the following:
|
It doesn't look like the esp8266 platform package was installed properly. Your error log makes reference to the hardware platform files here: C:\Users\devuser\documents\arduino\hardware\espressif\esp8266 but that's not where they should be. Did you install the esp8266 platform using the Board Manager or manually install it from GitHub? I would recommend starting over and installing the esp8266 platform using the Board Manager as described here: https://github.com/esp8266/Arduino#installing-with-boards-manager. The Board Manager will put things where they belong. After installing the platform make sure it shows up in Board Manager: If that doesn't help, what example file are you trying to compile? |
Hi,
But i prefer to using git. |
If you're interested in getting the latest esp8266 platform code (it does have some nice bug fixes and performance improvements), you don't have to clone it from Git. You can still use the Board Manager to install the 2.4.0 release candidates. See the Obtaining 2.4.0-rc2 pre-release section here: |
Hi @moose4lord, this problem seems to exist in the final 2.4.0 (released on 02.01.2018) also. I'm not sure now how that can be fixed, but will also have a look at it. Regards |
Thanks for the heads up that v2.4.0 has finally been released. Dang, I was hoping this would be fixed before it was officially released. The problem stems from the way the arithmetic min() and max() functions are implemented. Before v2.4.0 they were implemented as macros and the macro parameters could be of different data types (byte, int, long or whatever). With v2.4.0 min() and max() are now implemented using the std::min and std::max library and both function parameters have to be the same data type, the compiler won't do implicit type conversion. :( So probably the easiest solution is to explicitly cast one of the two parameters when they are different data types. The WS2812FX library needs to be tweaked in two places. SEGMENT_RUNTIME.next_time = now + max(delay, SPEED_MIN); needs to be changed to this: SEGMENT_RUNTIME.next_time = now + max((int)delay, SPEED_MIN); And on line 538 this: lum = map(lum, 0, 64, min(25, _brightness), _brightness); needs to be changed to this: lum = map(lum, 0, 64, min(25, (int)_brightness), _brightness); There's other ways to fix this problem, so I'll let Harm do whatever he thinks best, but this should get you going again in the meantime. |
See: kitesurfer1404/WS2812FX#58 (comment) ```With v2.4.0 min() and max() are now implemented using the std::min and std::max library and both function parameters have to be the same data type, the compiler won't do implicit type conversion```
Hi,
I try to compile examples from WS2812FX, but i can't because some comping errors i get.
I am using Arduino IDE 1.8.5. All library is up to date.
Error log:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp: In member function 'void WS2812FX::service()':
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: error: no matching function for call to 'max(uint16_t&, int)'
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: candidates are:
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4236:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: mismatched types 'std::initializer_list<_Tp>' and 'short unsigned int'
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4231:5: note: template _Tp std::max(std::initializer_list<_Tp>)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4231:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: mismatched types 'std::initializer_list<_Tp>' and 'short unsigned int'
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:260:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: deduced conflicting types for parameter 'const _Tp' ('short unsigned int' and 'int')
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:216:5: note: template const _Tp& std::max(const _Tp&, const _Tp&)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:216:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: deduced conflicting types for parameter 'const _Tp' ('short unsigned int' and 'int')
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp: In member function 'uint16_t WS2812FX::mode_fade()':
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: error: no matching function for call to 'min(int, uint8_t&)'
b = map(b, 0, 64, min(25, _brightness), _brightness);
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: candidates are:
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4226:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
b = map(b, 0, 64, min(25, _brightness), _brightness);
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4221:5: note: template _Tp std::min(std::initializer_list<_Tp>)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4221:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
b = map(b, 0, 64, min(25, _brightness), _brightness);
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:239:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint8_t {aka unsigned char}')
b = map(b, 0, 64, min(25, _brightness), _brightness);
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:193:5: note: template const _Tp& std::min(const _Tp&, const _Tp&)
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:193:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint8_t {aka unsigned char}')
b = map(b, 0, 64, min(25, _brightness), _brightness);
Using library WS2812FX in folder: C:\Users\devuser\Documents\Arduino\libraries\WS2812FX (legacy)
Using library Adafruit_NeoPixel at version 1.1.3 in folder: C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel
Using library ESP8266WebServer at version 1.0 in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ESP8266WebServer
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ESP8266WiFi
Using library ArduinoJson at version 5.11.2 in folder: C:\Users\devuser\Documents\Arduino\libraries\ArduinoJson
Using library ArduinoOTA at version 1.0 in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ArduinoOTA
Using library ESP8266mDNS in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ESP8266mDNS (legacy)
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
If you need another information just write to me :)
Thanks in advance!
The text was updated successfully, but these errors were encountered: