0 votes
by (150 points)
Followed the IDE setup guide and using the current version of the required libraries.
Problem:
Compilation error from line 268 in esp8266-spotify-remote.ino and line 454 in SpotifyClient.cpp.

Full error message:

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\esp8266-spotify-remote.ino: In function 'void drawSongInfo()':

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\esp8266-spotify-remote.ino:268:70: error: no matching function for call to 'min(long unsigned int, uint32_t&)'

  268 |   drawProgress(min(data.progressMs + timeSinceUpdate, data.durationMs), data.durationMs, data.title, data.artistName, data.isPlaying, data.isPlayerActive);

      |                                                                      ^

In file included from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\algorithm:62,

                 from C:\Users\dly28\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Arduino.h:229,

                 from C:\Users\dly28\AppData\Local\Temp\arduino\sketches\F43F5AE7C5F57203D99729C59B86BBAF\sketch\esp8266-spotify-remote.ino.cpp:1:

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3479:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'

 3479 |     min(initializer_list<_Tp> __l, _Compare __comp)

      |     ^~~

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3479:5: note:   template argument deduction/substitution failed:

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\esp8266-spotify-remote.ino:268:70: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'

  268 |   drawProgress(min(data.progressMs + timeSinceUpdate, data.durationMs), data.durationMs, data.title, data.artistName, data.isPlaying, data.isPlayerActive);

      |                                                                      ^

In file included from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\algorithm:62,

                 from C:\Users\dly28\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Arduino.h:229,

                 from C:\Users\dly28\AppData\Local\Temp\arduino\sketches\F43F5AE7C5F57203D99729C59B86BBAF\sketch\esp8266-spotify-remote.ino.cpp:1:

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3473:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'

 3473 |     min(initializer_list<_Tp> __l)

      |     ^~~

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3473:5: note:   template argument deduction/substitution failed:

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\esp8266-spotify-remote.ino:268:70: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'

  268 |   drawProgress(min(data.progressMs + timeSinceUpdate, data.durationMs), data.durationMs, data.title, data.artistName, data.isPlaying, data.isPlayerActive);

      |                                                                      ^

In file included from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\specfun.h:45,

                 from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\cmath:1927,

                 from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,

                 from C:\Users\dly28\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Arduino.h:34,

                 from C:\Users\dly28\AppData\Local\Temp\arduino\sketches\F43F5AE7C5F57203D99729C59B86BBAF\sketch\esp8266-spotify-remote.ino.cpp:1:

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'

  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)

      |     ^~~

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:278:5: note:   template argument deduction/substitution failed:

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\esp8266-spotify-remote.ino:268:70: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'uint32_t' {aka 'unsigned int'})

  268 |   drawProgress(min(data.progressMs + timeSinceUpdate, data.durationMs), data.durationMs, data.title, data.artistName, data.isPlaying, data.isPlayerActive);

      |                                                                      ^

In file included from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\specfun.h:45,

                 from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\cmath:1927,

                 from c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,

                 from C:\Users\dly28\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Arduino.h:34,

                 from C:\Users\dly28\AppData\Local\Temp\arduino\sketches\F43F5AE7C5F57203D99729C59B86BBAF\sketch\esp8266-spotify-remote.ino.cpp:1:

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'

  230 |     min(const _Tp& __a, const _Tp& __b)

      |     ^~~

c:\users\dly28\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.1.0-gcc10.3-e5f9fec\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:230:5: note:   template argument deduction/substitution failed:

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\esp8266-spotify-remote.ino:268:70: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'uint32_t' {aka 'unsigned int'})

  268 |   drawProgress(min(data.progressMs + timeSinceUpdate, data.durationMs), data.durationMs, data.title, data.artistName, data.isPlaying, data.isPlayerActive);

      |                                                                      ^

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\SpotifyClient.cpp: In member function 'void SpotifyClient::downloadFile(String, String)':

C:\Users\dly28\AppData\Local\Temp\7zO8FF71B23\esp8266-spotify-remote\SpotifyClient.cpp:454:15: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)

  454 |     http.begin(url);

      |     ~~~~~~~~~~^~~~~

exit status 1

Compilation error: no matching function for call to 'min(long unsigned int, uint32_t&)'

Attempted solutions:
To fix the SpotifyClient.cpp issue, I included WiFiClientSecure.h, created a WiFiClientSecure named wifiClient in the SpotifyClient::downloadFile function and changed http.begin(url); to http.begin(wifiClient, url);.
To fix the esp8266-spotify-remote.ino issue, I used the min definition from SpotifyClient.cpp and added it here.
These changes resulted in a successful compilation and upload but the display is asking for authentication and the link won't load no matter the browser or device. Not sure if it's something with the code changes I made. I am very inexperienced with coding and all of these solutions were quick Google lookups.
by (19.9k points)
What is the version of the ESP8266 Arduino Core library that you are using?

It looks like the first reported issue concerns the `min` macro we have at https://github.com/ThingPulse/esp8266-spotify-remote/blob/master/SpotifyClient.cpp#L28.

As for the second issue, the proper fix will be determined by the URLs Spotify uses these days for its artwork (HTTP vs. HTTPS vs. ???). What is the URL reported by the debug statement at https://github.com/ThingPulse/esp8266-spotify-remote/blob/master/SpotifyClient.cpp#L444 (check the IDE serial console)?
by (150 points)
Version 3.1.2 of the esp8266 library by ESP8266 is installed. I can't find a serial console but I have the serial monitor open and nothing is appearing because compilation fails. I did some research on Spotify artwork URLs and it looks like it's HTTPS.
by (19.9k points)
I managed to fix the few issues that caused compilation errors. Turns out we already had a work-in-progress branch with a few changes from 2020. I committed the new ones on top of that: https://github.com/ThingPulse/esp8266-spotify-remote/compare/master...fix/bssl-memory. Also, remember this part that we have printed onto the console during compilation: https://support.thingpulse.com/1065/error-compiling-esp8266-spotify-remote?show=1072#a1072

That being said, in accordance with https://github.com/ThingPulse/esp8266-spotify-remote#service-level-promise I haven't actually tested my latest changes on a device yet.
by (150 points)
I swapped out the old code for the new and compilation was successful. Everything seems to be working fine now. Thank you very much.

1 Answer

0 votes
by (19.9k points)
 
Best answer
Resolved by updating the code in the repo.

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...