Caerbannog/esphttpclient

Error: implicit declaration of function

tinamore opened this issue · 3 comments

Hi
Thankyou for your project

I combine esphttpclient into epshttpd. When compile show error:

CC httpclient.c
httpclient.c: In function 'esp_strdup':
httpclient.c:45:2: error: implicit declaration of function 'pvPortMalloc' [-Werror=implicit-function-declaration]
char * new_str = (char *)os_malloc(os_strlen(str) + 1); // 1 for null character
^
httpclient.c:45:2: error: implicit declaration of function 'ets_strlen' [-Werror=implicit-function-declaration]
httpclient.c:47:3: error: implicit declaration of function 'os_printf_plus' [-Werror=implicit-function-declaration]
os_printf("esp_strdup: malloc error");
^
httpclient.c:50:2: error: implicit declaration of function 'ets_strcpy' [-Werror=implicit-function-declaration]
os_strcpy(new_str, str);
^
httpclient.c: In function 'receive_callback':
httpclient.c:76:2: error: implicit declaration of function 'ets_memcpy' [-Werror=implicit-function-declaration]
os_memcpy(new_buffer, req->buffer, req->buffer_size);
^
httpclient.c:80:2: error: implicit declaration of function 'vPortFree' [-Werror=implicit-function-declaration]
os_free(req->buffer);
^
httpclient.c: In function 'connect_callback':
httpclient.c:119:3: error: implicit declaration of function 'ets_sprintf' [-Werror=implicit-function-declaration]
os_sprintf(post_headers, "Content-Length: %d\r\n", strlen(req->post_data));
^
httpclient.c: In function 'disconnect_callback':
httpclient.c:166:4: error: implicit declaration of function 'ets_strncmp' [-Werror=implicit-function-declaration]
if (os_strncmp(req->buffer, version, strlen(version)) != 0) {
^
httpclient.c:170:5: error: implicit declaration of function 'atoi' [-Werror=implicit-function-declaration]
http_status = atoi(req->buffer + strlen(version));
^
httpclient.c:171:5: error: implicit declaration of function 'ets_strstr' [-Werror=implicit-function-declaration]
body = (char *)os_strstr(req->buffer, "\r\n\r\n") + 4;

^

Can you fix help me. Thanks

I think there is something wrong with your SDK, please reconfigure it.

Download espmissingincludes.h to your include folder and #include it user_main.c (or another appropriate place)

I think the errors you are getting is because many of the SDK functions don't have a declaration (Espressif "forgot" to provide them) and because you are compiling with -Werror
(all warnings are treated as errors)

@by2coffee was right
This should now be fixed in master.