I updated the esp-idf to the latest version on master and now get this error.
error: called object 'socket' is not a function or function pointer
socket = socket(PF_INET, SOCK_STREAM, 0);
I get this error on this line https://github.com/tuanpmt/esp-request/blob/master/esp_request.c#L65
The code worked and compiled when I was on commit e43ac33b7c592f6c9ffc45523f04719934e3ad68 (https://github.com/espressif/esp-idf/tree/e43ac33b7c592f6c9ffc45523f04719934e3ad68)
I think the error has something to do with this commit https://github.com/espressif/esp-idf/commit/1c0543fb17ec700d27eaad9c379407047e82eb61
The variable on the left side is called socket, and it shadows the name of socket function, causing this error.
The variable has to be renamed to something else, for example socket_fd.
Previously it worked because socket was defined as a macro taking arguments. So single occurrence of socket without argument list was not expanded, whereas socket( args...) was expanded into lwip_socket( args...) by the preprocessor.
Most helpful comment
The variable on the left side is called
socket, and it shadows the name ofsocketfunction, causing this error.The variable has to be renamed to something else, for example
socket_fd.Previously it worked because
socketwas defined as a macro taking arguments. So single occurrence ofsocketwithout argument list was not expanded, whereassocket( args...)was expanded intolwip_socket( args...)by the preprocessor.