Skip to content
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

error: called object 'socket' is not a function or function pointer #1349

Closed
tdesmet opened this issue Dec 5, 2017 · 1 comment
Closed

Comments

@tdesmet
Copy link

tdesmet commented Dec 5, 2017

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 e43ac33 (https://github.com/espressif/esp-idf/tree/e43ac33b7c592f6c9ffc45523f04719934e3ad68)

I think the error has something to do with this commit 1c0543f

@igrr
Copy link
Member

igrr commented Dec 5, 2017

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.

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

2 participants