Skip to content

HTTPUpdate not working. Update.h:44:10: note: candidate expects 2 arguments, 4 provided #2094

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

Closed
Zeni241 opened this issue Nov 22, 2018 · 14 comments

Comments

@Zeni241
Copy link

Zeni241 commented Nov 22, 2018

  1. I installed arduino-esp32 using library manager in Arduino IDE.
  2. I copy and paste code from here:

arduino-esp32/libraries/HTTPUpdate/examples/httpUpdate/httpUpdate.ino In Arduino IDE and compiled. I get following error:

    **_ESP32HTTPUpdate:12:24: error: HTTPUpdate.h: No such file or directory_**
  1. I downloaded “arduino-esp32” zip file from github and unzipped two missing libraries, “HTTPUpdate” and “FFat” in my libraries folder C:\Users\xxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries

  2. Again compiled the sketch and get following error:

__> Multiple libraries were found for "WiFi.h"

bool begin(size_t size=UPDATE_SIZE_UNKNOWN, int command = U_FLASH);
Used: C:\Users\xxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
_ _C:\Users\xxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\Update\src/Update.h:44:10: note: candidate expects 2 arguments, 4 provided
exit status 1
Error compiling for board ESP32 Dev Module.__

I am using esp32 DevKit V1. I don't know what I am doing wrong. I am using httpUpdate in esp8266 successfully.

@Jeroen88
Copy link
Contributor

What function call is causing the error? If I look in the ESP32 repository at line 44:10 in Update.h I see no function but a #define.
Please add the exact sketch you are compiling. I suspect that you are calling the ESP32 library using deprecated ESP8266 functions

@Zeni241
Copy link
Author

Zeni241 commented Nov 22, 2018

First of all thanks for your quick response.
Here is complete code I am using:

#include <Arduino.h>
#include <WiFi.h>
#include <HTTPClient.h>
#include <HTTPUpdate.h>



const char *ssid = "myssid";  //ENTER YOUR WIFI SETTINGS
const char *password = "mypassword";
String version="v2"; 

void setup() {

  Serial.begin(115200);
  Serial.setDebugOutput(true);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
       Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

}

void loop() {
 
  if ((WiFi.status() == WL_CONNECTED)) {

    WiFiClient client;
    
     //  t_httpUpdate_return ret = httpUpdate.update(client, "http://mydomain.com/updater");
         t_httpUpdate_return ret = httpUpdate.update(client, "mydomain.com",80,"/updater",version); // This I use successfully with esp8266
    
    // Or:
    //t_httpUpdate_return ret = httpUpdate.update(client, "server", 80, "file.bin");

    switch (ret) {
      case HTTP_UPDATE_FAILED:
        Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
        break;

      case HTTP_UPDATE_NO_UPDATES:
        Serial.println("HTTP_UPDATE_NO_UPDATES");
        break;

      case HTTP_UPDATE_OK:
        Serial.println("HTTP_UPDATE_OK");
        break;
    }
  }
}

And here is the messages in bottom window of Arduino IDE:



C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp: In member function 'HTTPUpdateResult HTTPUpdate::update(WiFiClient&, const String&, const String&)':

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:49:27: error: no matching function for call to 'HTTPClient::begin(WiFiClient&, const String&)'

     http.begin(client, url);

                           ^

In file included from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.h:33:0,

                 from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:26:

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:129:10: note: candidate: bool HTTPClient::begin(String)

     bool begin(String url);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:129:10: note:   candidate expects 1 argument, 2 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:130:10: note: candidate: bool HTTPClient::begin(String, const char*)

     bool begin(String url, const char* CAcert);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:130:10: note:   no known conversion for argument 1 from 'WiFiClient' to 'String'

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:131:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String)

     bool begin(String host, uint16_t port, String uri = "/");

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:131:10: note:   no known conversion for argument 1 from 'WiFiClient' to 'String'

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:132:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String, const char*)

     bool begin(String host, uint16_t port, String uri, const char* CAcert);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:132:10: note:   candidate expects 4 arguments, 2 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:133:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String, const char*, const char*, const char*)

     bool begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:133:10: note:   candidate expects 6 arguments, 2 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp: In member function 'HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient&, const String&, const String&)':

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:56:27: error: no matching function for call to 'HTTPClient::begin(WiFiClient&, const String&)'

     http.begin(client, url);

                           ^

In file included from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.h:33:0,

                 from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:26:

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:129:10: note: candidate: bool HTTPClient::begin(String)

     bool begin(String url);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:129:10: note:   candidate expects 1 argument, 2 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:130:10: note: candidate: bool HTTPClient::begin(String, const char*)

     bool begin(String url, const char* CAcert);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:130:10: note:   no known conversion for argument 1 from 'WiFiClient' to 'String'

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:131:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String)

     bool begin(String host, uint16_t port, String uri = "/");

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:131:10: note:   no known conversion for argument 1 from 'WiFiClient' to 'String'

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:132:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String, const char*)

     bool begin(String host, uint16_t port, String uri, const char* CAcert);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:132:10: note:   candidate expects 4 arguments, 2 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:133:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String, const char*, const char*, const char*)

     bool begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:133:10: note:   candidate expects 6 arguments, 2 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp: In member function 'HTTPUpdateResult HTTPUpdate::update(WiFiClient&, const String&, uint16_t, const String&, const String&)':

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:64:39: error: no matching function for call to 'HTTPClient::begin(WiFiClient&, const String&, uint16_t&, const String&)'

     http.begin(client, host, port, uri);

                                       ^

In file included from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.h:33:0,

                 from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:26:

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:129:10: note: candidate: bool HTTPClient::begin(String)

     bool begin(String url);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:129:10: note:   candidate expects 1 argument, 4 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:130:10: note: candidate: bool HTTPClient::begin(String, const char*)

     bool begin(String url, const char* CAcert);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:130:10: note:   candidate expects 2 arguments, 4 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:131:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String)

     bool begin(String host, uint16_t port, String uri = "/");

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:131:10: note:   candidate expects 3 arguments, 4 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:132:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String, const char*)

     bool begin(String host, uint16_t port, String uri, const char* CAcert);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:132:10: note:   no known conversion for argument 1 from 'WiFiClient' to 'String'

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:133:10: note: candidate: bool HTTPClient::begin(String, uint16_t, String, const char*, const char*, const char*)

     bool begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPClient\src/HTTPClient.h:133:10: note:   candidate expects 6 arguments, 4 provided

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp: In member function 'bool HTTPUpdate::runUpdate(Stream&, uint32_t, String, int)':

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:319:52: error: no matching function for call to 'UpdateClass::begin(uint32_t&, int&, int&, uint8_t&)'

     if(!Update.begin(size, command, _ledPin, _ledOn)) {

                                                    ^

In file included from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.h:34:0,

                 from C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\HTTPUpdate\src\HTTPUpdate.cpp:26:

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\Update\src/Update.h:44:10: note: candidate: bool UpdateClass::begin(size_t, int)

     bool begin(size_t size=UPDATE_SIZE_UNKNOWN, int command = U_FLASH);

          ^

C:\Users\xxxxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\Update\src/Update.h:44:10: note:   candidate expects 2 arguments, 4 provided

exit status 1
Error compiling for board ESP32 Dev Module.

@Jeroen88
Copy link
Contributor

I suspect you do not have the latest HTTPClient. This client is part of PR #1979. Since PR #1979 was merged into master a few days ago, you should pull in the latest git version in stead of copying just a few files. This should give you all the lastest libraries, including the lastest HTTPUpdate and the lastest HTTPClient.

@Zeni241
Copy link
Author

Zeni241 commented Nov 22, 2018

Thanks again. I have downloaded arduino-esp32-master.zip file and added only two missing libraries, HTTPUpdate” and “FFat” in my libraries folder C:\Users\xxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries
OK now I replace the whole library folder from this downloaded zip file and try again.

@Jeroen88
Copy link
Contributor

Your welcome!

@Zeni241
Copy link
Author

Zeni241 commented Nov 22, 2018

Replaced the whole folder of libraries in

C:\Users\xxxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\ by downloaded latest

version.
On compilation following error:

C:\Users\faraz\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\WiFi\src\WiFiAP.cpp:40:43: fatal error: dhcpserver/dhcpserver_options.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board ESP32 Dev Module.

Replaced new WiFi folder (19 Nov 2018) in libraries with old WiFi folder (28 July 2018).
Compiled again.
This time SUCCESS!!
Only errors as below which are not related to httpUpdate.

Invalid library found in C:\Users\faraz\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\AzureIoT: no headers files (.h) found in C:\Users\faraz\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\AzureIoT
Invalid library found in C:\Users\faraz\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\BLE: no headers files (.h) found in C:\Users\faraz\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\BLE

Tomorrow I will upload new version of sketch on my server and see how the actual update goes. I will post the results here tomorrow.

Thanks a lot Jeroen88. It was not possible without your prompt replies.

@mouridis
Copy link
Contributor

The errors you get about AzureIoT and BLE libraries are because you did not "recursively clone submodules" while cloning the repo with git. You can follow the official instructions for cloning this repo to fix this.

@Zeni241
Copy link
Author

Zeni241 commented Nov 22, 2018

Thanks mouridis, seems like I can no more avoid learning GitHub , (which I avoided my whole life with utmost passion :) :) ).

@Jeroen88
Copy link
Contributor

I tried to be ignorant for git too, but once you see the light... ;)

@Zeni241
Copy link
Author

Zeni241 commented Nov 23, 2018

Good morning and good news. Uploaded new bin file on server, ESP32 downloaded, installed and running new sketch obediently, like a good boy. Every thing worked like charm.
Now I can wait for other headers,( x-ESP32-free-space, x-ESP32-sketch-size, x-ESP32-chip-size) to be implemented in httpUpdate.ccp.
Thanks again to all the folks, especially Jeroen88 for all the help.

@Zeni241 Zeni241 closed this as completed Nov 23, 2018
@Jeroen88
Copy link
Contributor

@Zeni241 I created PR #2116 implementing the request headers you mention above.

@Zeni241
Copy link
Author

Zeni241 commented Nov 28, 2018

Thanks a lot.

@TLS1000
Copy link

TLS1000 commented Dec 4, 2018

Hi, I also get the message during compiling: error: HTTPUpdate.h: No such file or directory_**

While it's in the "C:\Users\myname\Documents\Arduino\hardware\espressif\esp32\libraries\HTTPUpdate\src" folder.

Quick and dirty is to copy paste the HTTPUpdate.h file to the sketch folder. But why are other libraries of the ESP32 found, and this one not?

@TLS1000
Copy link

TLS1000 commented Dec 4, 2018

update: before I was updating, or trying to update the ESP-Arduino core using GIT. But recently switched to the Arduino IDE for updating the core. Most of the libraries are part the the stable release, you need to set the additional board manager url to the 'developer release' for libraries like httpupdate. developer url: 'https://dl.espressif.com/dl/package_esp32_dev_index.json'. So basically I can forget about the GIT-stuff, which I don't mind to be honest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants