easytarget / esp32-cam-webserver

Expanded version of the Espressif ESP webcam
https://hackaday.io/project/168563-7-esp32-cam-example-expanded
GNU Lesser General Public License v2.1
1.31k stars 352 forks source link

Unable to compile in Arduino IDE 2.0.0 with arduino-esp32 core v2.0.5 (latest) #278

Open nonsintetic opened 2 years ago

nonsintetic commented 2 years ago

Code version: 4.0 Board: AI Thinker ESP32-CAM Partition Scheme: Minimal SPIFFS

Getting these errors when trying to compile. Guess it's something in the latest arduino core that's changed.

D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp: In function 'void serialDump()':
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:151:19: error: format '%i' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
     Serial.printf("CPU Freq: %i MHz, Xclk Freq: %i MHz\r\n", ESP.getCpuFreqMHz(), xclk);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                       ~~~~
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp: In function 'esp_err_t status_handler(httpd_req_t*)':
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:452:23: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format=]
         p+=sprintf(p, "\"xclk\":%u,", xclk);
                       ^~~~~~~~~~~~~~  ~~~~
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp: In function 'esp_err_t dump_handler(httpd_req_t*)':
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:601:19: error: format '%i' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
     d+= sprintf(d,"CPU Freq: %i MHz, Xclk Freq: %i MHz<br>\n", ESP.getCpuFreqMHz(), xclk);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                       ~~~~
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp: In function 'void startCameraServer(int, int)':
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:755:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:755:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:755:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:761:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:761:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:761:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:767:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:767:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:767:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:773:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:773:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:773:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:779:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:779:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:779:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:785:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:785:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:785:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:791:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:791:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:791:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:797:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:797:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:797:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:803:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:803:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:803:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:809:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:809:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:809:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:815:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:815:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:815:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:821:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:821:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:821:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:827:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:827:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:827:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:833:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:833:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:833:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:839:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:839:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:839:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:845:5: warning: missing initializer for member 'httpd_uri::is_websocket' [-Wmissing-field-initializers]
     };
     ^
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:845:5: warning: missing initializer for member 'httpd_uri::handle_ws_control_frames' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\app_httpd.cpp:845:5: warning: missing initializer for member 'httpd_uri::supported_subprotocol' [-Wmissing-field-initializers]
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino: In function 'void StartCamera()':
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:332:12: warning: 'camera_config_t::<unnamed union>::pin_sscb_sda' is deprecated: please use pin_sccb_sda instead [-Wdeprecated-declarations]
     config.pin_sscb_sda = SIOD_GPIO_NUM;
            ^~~~~~~~~~~~
In file included from D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:1:
C:\Users\offic\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:117:87: note: declared here
         int pin_sscb_sda __attribute__((deprecated("please use pin_sccb_sda instead")));           /*!< GPIO pin for camera SDA line (legacy name) */
                                                                                       ^
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:332:12: warning: 'camera_config_t::<unnamed union>::pin_sscb_sda' is deprecated: please use pin_sccb_sda instead [-Wdeprecated-declarations]
     config.pin_sscb_sda = SIOD_GPIO_NUM;
            ^~~~~~~~~~~~
In file included from D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:1:
C:\Users\offic\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:117:87: note: declared here
         int pin_sscb_sda __attribute__((deprecated("please use pin_sccb_sda instead")));           /*!< GPIO pin for camera SDA line (legacy name) */
                                                                                       ^
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:332:12: warning: 'camera_config_t::<unnamed union>::pin_sscb_sda' is deprecated: please use pin_sccb_sda instead [-Wdeprecated-declarations]
     config.pin_sscb_sda = SIOD_GPIO_NUM;
            ^~~~~~~~~~~~
In file included from D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:1:
C:\Users\offic\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:117:87: note: declared here
         int pin_sscb_sda __attribute__((deprecated("please use pin_sccb_sda instead")));           /*!< GPIO pin for camera SDA line (legacy name) */
                                                                                       ^
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:333:12: warning: 'camera_config_t::<unnamed union>::pin_sscb_scl' is deprecated: please use pin_sccb_scl instead [-Wdeprecated-declarations]
     config.pin_sscb_scl = SIOC_GPIO_NUM;
            ^~~~~~~~~~~~
In file included from D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:1:
C:\Users\offic\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:121:87: note: declared here
         int pin_sscb_scl __attribute__((deprecated("please use pin_sccb_scl instead")));           /*!< GPIO pin for camera SCL line (legacy name) */
                                                                                       ^
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:333:12: warning: 'camera_config_t::<unnamed union>::pin_sscb_scl' is deprecated: please use pin_sccb_scl instead [-Wdeprecated-declarations]
     config.pin_sscb_scl = SIOC_GPIO_NUM;
            ^~~~~~~~~~~~
In file included from D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:1:
C:\Users\offic\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:121:87: note: declared here
         int pin_sscb_scl __attribute__((deprecated("please use pin_sccb_scl instead")));           /*!< GPIO pin for camera SCL line (legacy name) */
                                                                                       ^
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:333:12: warning: 'camera_config_t::<unnamed union>::pin_sscb_scl' is deprecated: please use pin_sccb_scl instead [-Wdeprecated-declarations]
     config.pin_sscb_scl = SIOC_GPIO_NUM;
            ^~~~~~~~~~~~
In file included from D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:1:
C:\Users\offic\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:121:87: note: declared here
         int pin_sscb_scl __attribute__((deprecated("please use pin_sccb_scl instead")));           /*!< GPIO pin for camera SCL line (legacy name) */
                                                                                       ^
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino: In lambda function:
D:\ARDUINO\Projects\esp32-cam-webserver\esp32-cam-webserver.ino:727:27: error: unused variable 'err' [-Werror=unused-variable]
                 esp_err_t err = esp_camera_deinit();
                           ^~~
cc1plus.exe: some warnings being treated as errors
cc1plus.exe: some warnings being treated as errors

exit status 1

Compilation error: format '%i' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
sonofcy commented 2 years ago

Change the compiler errors to default, you have all and the library code has some trivial errors.

Screenshot 2022-11-29 at 12 39 28